Bug 55872 - ColumnGroupCollapsed and autoSizeColumn don't work together
Summary: ColumnGroupCollapsed and autoSizeColumn don't work together
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-12 15:02 UTC by Jens
Modified: 2013-12-16 07:19 UTC (History)
1 user (show)



Attachments
Excel document. Top: with sheet.autoSizeColumn(4); Bottom: without sheet.autoSizeColumn(4); (51.56 KB, image/png)
2013-12-12 15:02 UTC, Jens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens 2013-12-12 15:02:08 UTC
Created attachment 31109 [details]
Excel document. Top: with sheet.autoSizeColumn(4);     Bottom: without sheet.autoSizeColumn(4);

Apache POI Version: 3.9 (20121203)
Java Version: 1.6.0_26


Hi,

if I execute the following code the Excel-Document does not fulfil my expectations (see attachment):


SXSSFWorkbook wb = new SXSSFWorkbook( 100000 );
Sheet sheet = wb.createSheet();

Row row = sheet.createRow(0);
for(int i=0; i < 10; i++) {
    row.createCell(i).setCellValue("Some content");
}

sheet.autoSizeColumn(2);
sheet.autoSizeColumn(3);
//sheet.autoSizeColumn(4);  // with this, it works!

sheet.groupColumn(2, 3);
sheet.setColumnGroupCollapsed(2, true);

try {
    File file = File.createTempFile("output", ".xlsx");
    wb.write(new FileOutputStream(file));

    System.out.println(file.getAbsolutePath());
} catch (Exception ex) {}



The excel document is right, when I uncomment this line:
sheet.autoSizeColumn(4);



I've tried to set the default column width with
sheet.setDefaultColumnWidth(20);

but it has no effect.
Comment 1 vladk 2013-12-13 07:07:31 UTC
Can you try version 3.10-beta2? 
http://search.maven.org/#artifactdetails|org.apache.poi|poi|3.10-beta2|jar

I believe your issue has the same roots as https://issues.apache.org/bugzilla/show_bug.cgi?id=52186. That problem should be fixed as of version 3.10-beta2.
Comment 2 Jens 2013-12-16 07:19:16 UTC
Thank you vladk, it is fixed in 3.10-beta2.