Bug 56200

Summary: Sheet not visible with Java 1.7
Product: POI Reporter: Chris W <ktrykid>
Component: XSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Code used for Debugging

Description Chris W 2014-02-28 14:56:42 UTC
Created attachment 31355 [details]
Code used for Debugging

Using the same code, I get different results between the 1.6.43x64 JRE and the 1.7.21x64 JRE.  With 1.6 JRE the spreadsheet formats as expected.  With 1.7 JRE, the created columns appear hidden.  I've tried with POI 3.8 and 3.10 Final.  The data is in the spreadsheet.  If I select all rows/columns and paste values to another sheet, I see the information entered.
Comment 1 Nick Burch 2014-02-28 15:05:37 UTC
Since you're using .xlsx, the file format is a zip of xml files. Any chance you could unzip the .xlsx files from 1.6 and 1.7, then compare them for differences?
Comment 2 Chris W 2014-02-28 15:29:54 UTC
Unzipped and examined with a compare tool.  The main difference I see is the Width attribute under the \xl\worksheets\sheet1.xml on the column tags.  I also note that if I comment out the sheet.autosizecolumn() that it shows up.  So somehow the font/data size is getting interpreted as zero?
Comment 3 Nick Burch 2014-02-28 15:32:18 UTC
Are you certain you're using the same jars on both JVMs? http://poi.apache.org/faq.html#faq-N10006 has some code you can use to verify this
Comment 4 Chris W 2014-02-28 15:48:46 UTC
I'm pretty sure.  I've executed it different ways to isolate the cause.  I created executable JARs and that's where I first noticed the difference but I recreated it when I changed the JRE Library in Eclipse.
Comment 5 Chris W 2014-02-28 15:55:41 UTC
Confirmed.  Just added those lines and ran it with both JREs.  POI Jar paths are the same.  Results are different.
Comment 6 Chris W 2014-02-28 16:08:14 UTC
Here's the differences in the sheet1.xml files that I unzipped.

JRE 1.6
<col min="1" max="1" width="8.7265625" customWidth="true" bestFit="true"/>
<col min="2" max="2" width="13.703125" customWidth="true" bestFit="true"/>
<col min="3" max="3" width="20.859375" customWidth="true" bestFit="true"/>

JRE 1.7
<col min="1" max="1" width="0.0" customWidth="true" bestFit="true"/>
<col min="2" max="2" width="0.0" customWidth="true" bestFit="true"/>
<col min="3" max="3" width="0.0" customWidth="true" bestFit="true"/>
Comment 7 Nick Burch 2014-02-28 16:14:06 UTC
Can you check what fonts both JVMs can see? (AWT should let you check the fonts installed + available to the JVM). I wonder if the 1.7 JVM is either missing a key font, or has a broken font file?
Comment 8 Chris W 2014-02-28 18:08:28 UTC
Getting a list of the available Fonts appears identical in both JVMs.
Comment 9 Chris W 2014-02-28 20:36:34 UTC
I do believe it is Font related though.  I changed to cell_normal style to set the Font to "Consolas" and it formats it as desired.  Leaving it set to the default Font (which is "Calibri") seems to be the root of the problem.
Comment 10 awm 2014-03-02 01:31:54 UTC
autoSizeColumn has been causing issues with JAVA 7 since the very release of 1.7.0.  For some reason I remember you (Nick) saying that you had narrowed it down to a bug in Java libs.  I may have to go back to the archives and see if I can find that thread.
Comment 11 Nick Burch 2014-03-07 06:32:36 UTC
As mentioned on list, if someone could write a very small unit test based on that, which works on 6 but fails on 7, that'd be very helpful!

Perhaps something that does:
 * new workbook
 * create some cells
 * sets some styles, fonts etc
 * autosizes two columns
 * saves
 * loads
 * checks column widths
 * asserts that simple columns are right (6 and 7 ok?)
 * asserts that some more complex ones are too (fails on 7?)

The simpler and more standalone it is, the better the chances someone will be able to reproduce + investigate + fix!
Comment 12 Ole Tjensvold Johannessen 2014-03-13 10:24:07 UTC

try to upgrade your JDK
Comment 13 Chris W 2014-04-07 14:49:54 UTC
Updating to 1.7.51 seems to resolve this issue.