Bug 56683 - SXSSF generated corrupted report in z/OS on applying cell Style
Summary: SXSSF generated corrupted report in z/OS on applying cell Style
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.10-FINAL
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-06-30 11:47 UTC by Renjith
Modified: 2014-07-24 17:15 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Renjith 2014-06-30 11:47:02 UTC
I am trying to execute a program in z/OS machine to write an Excel report. Due to size of the report, we are using SXSSFWorkbook to write the report.

One of the cells in the report is grey in color. So I have to apply Color to that cell. I used the following code to set the color.

XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
XSSFColor myColor = new XSSFColor(DatatypeConverter
        .parseHexBinary("FFBFBFBF")); //also tried the java.awt.Color

But for the report generated, this cell is dark in color. Out of curiosity, I checked the Styles.xml inside the Excel document. The following is what I found.

<fill><patternFill patternType="solid"><fgColor rgb="ããâãâãâã"/></patternFill></fill>
I tried to generate the same report in a Windows machine, and it gave me correct result.

<fill><patternFill patternType="solid"><fgColor rgb="FFBFBFBF"/></patternFill>
Comment 1 Nick Burch 2014-06-30 12:30:57 UTC
The bad news is that this looks like it might be an xmlbeans bug

Any chance you could add the xmlbeans generated source to your IDE, then step into the CTColor code in a debugger and see how it serialises the bytes into xml?

See http://poi.apache.org/faq.html#faq-N1012A for help on getting the source of the CT classes
Comment 2 Renjith 2014-07-16 12:15:46 UTC
Not sure if the following update will fix it. need to try it out.

Updated writeTo() method of 'org.apache.poi.xssf.model.StylesTable'.

Change: Added the following line 


	 * Write this table out as XML.
	 * @param out The stream to write to.
	 * @throws IOException if an error occurs while writing.
	public void writeTo(OutputStream out) throws IOException {
	    //Setting default encoding to UTF-8
		XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);

Since i dont have control over the z/os server, i have to wait till it get tested.
In the mean time, please let me know your thoughts on the same.
Comment 3 Nick Burch 2014-07-24 17:15:05 UTC
Default of UTF-8 set in r1613193.