Hello Josh,
Unfortunately, the custom application runs on a dedicated app server
and the server restricts the JDK version to 1.4. I did find a patch
for the bug at
http://svn.apache.org/viewvc?view=revision&revision=736175
I have incorporated this patch and built my own POI jars. I no longer
get the ClassCastException. However, my code still does not create the
conditional formatting properly. My code is as below:
private void createConditionalFormattingObjects(int rowNumber, int
depCellColNum, int startCol, int endCol, String compareString) {
// Get sheet's conditional formatting object to be used later.
HSSFSheetConditionalFormatting scf =
m_dataSheet.getSheetConditionalFormatting();
CellReference invalidCellRef = new CellReference(rowNumber,
depCellColNum , true, true);
String formula = invalidCellRef.formatAsString() + "=" + compareString;
// Get sheet's conditional formatting object
HSSFConditionalFormattingRule rule =
scf.createConditionalFormattingRule(formula);
HSSFPatternFormatting patternFmt = rule.createPatternFormatting();
patternFmt.setFillBackgroundColor(HSSFColor.RED.index);
HSSFFontFormatting fontFmt = rule.createFontFormatting();
fontFmt.setStrikeout(true);
CellRangeAddress[] cra = { new CellRangeAddress(rowNumber,
rowNumber, startCol, endCol) };
scf.addConditionalFormatting(cra, rule);
}
I am not able to inspect the cell's conditional formatting when I open
the resulting file in excel. Any other suggestions?
On Wed, Dec 30, 2009 at 2:37 PM, Josh Micich <[email protected]> wrote:
>> I am not able to use POI 3.5 in my project because of the JDK 1.5
>> version dependency. I am working with third party API's and they
>> requires JDK 1.4.
>
> The presence of other third party APIs that require JRE 1.4 only
> prevents you from running prior java versions (e.g. JRE 1.3 won't run
> code compiled for 1.4 but JRE 5.0 would be OK). So 'third party APIs'
> shouldn't be a reason to avoid upgrading. The typical reason that POI
> users have for staying with JRE 1.4 is that their *application*server*
> is tied to that JRE (perhaps due to configuration management issues).
>
> I mention all of this because there are definite downsides with using
> a JRE which is past its end of life. If you *must* continue using JRE
> 1.4 and POI 3.2 then your best option might be to start maintaining
> your local version of POI, fixing bugs such as these.
>
> To fix your current problem, you should at least start by verifying
> whether it is observable in the latest POI (3.6). If it is an old bug
> there will be an existing fix, and if it is a new bug a new fix will
> need to be made to the latest trunk. Once the fix has been
> determined, it is often a simple task to apply it to a prior POI
> version.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]