poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46938] Existing color palette is broken(or not used) when using cell styles from opened workbook and creating new
Date Mon, 16 Nov 2009 13:36:37 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46938

--- Comment #13 from Karl Eilebrecht <Karl.Eilebrecht@freenet.de> 2009-11-16 05:36:32
UTC ---
Remark:

Today I tested (successfully) with a more complex excel sheet and found out
that the color-palette corruption problem may return if you modify cell styles
that came with the original file. Strange ...

To avoid this do not modify original cell styles but copy them (only once(!),
you do not have to duplicate them for single usage).

Problematic:
HSSFCellStyle myStyle = workbook.getCellStyleAt(idx);
myStyle.setFillPattern(HSSFCellStyle.BIG_SPOTS);
myStyle.setFillForegroundColor(HSSFColor.WHITE.index);
myStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//...
//use myStyle n-times

Better:
HSSFCellStyle myStyle = workbook.createCellStyle();
myStyle.cloneStyleFrom(workbook.getCellStyleAt(idx));
//...
//use myStyle n-times

Regards.
Karl

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message