Summary: | setRepeatingRowsAndColumns only works on 1st and 2nd sheet | ||
---|---|---|---|
Product: | POI | Reporter: | tandyawa |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | joern |
Priority: | P2 | ||
Version: | 3.0-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Attachments: |
Defect workbook
Valid workbook |
Description
tandyawa
2004-12-01 20:09:25 UTC
I think this is now working correctly on 3.1 final. Please re-open the bug if you're still having problems with 3.1 final Does not work with 3.1-final either. @Test public void testGenerateExcelFile() throws Exception { String fileName = "TestSetRepeatingRowsAndColumns.xls"; HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet1 = wb.createSheet("new sheet"); HSSFSheet sheet2 = wb.createSheet("second sheet"); // Set the columns to repeat from column 0 to 2 on the first sheet wb.setRepeatingRowsAndColumns(0, -1, -1, 0, 0); // Set the the repeating rows and columns on the second sheet. // if the following line is removed, the excel is ok, if added, an error is shown, when opening the workbook wb.setRepeatingRowsAndColumns(0, -1, -1, 0, 0); try { FileOutputStream fileOut = new FileOutputStream(fileName); wb.write(fileOut); fileOut.close(); System.out.println ("File written to "+fileOut.toString()); } catch (Exception ex) { fail("Cannot write file!"); } } Created attachment 22460 [details]
Defect workbook
Excel file generated with source code provided in comment
Created attachment 22461 [details]
Valid workbook
Valid workbook created with source added in comment
The error is somehow influenced by the name of the sheet - but I could not find the relation. In one of our projects we have a workbook with two sheets - first named "WTU versorgt", second named "eigenversorgt". The workaround for this issue: we changed the order of the two sheets during creation. Instead of HSSFSheet sheet = workbook.createSheet("WTU versorgt"); HSSFSheet sheet = workbook.createSheet("eigenversorgt"); we have now HSSFSheet sheet = workbook.createSheet("eigenversorgt"); HSSFSheet sheet = workbook.createSheet("WTU versorgt"); and it works, no error is shown while opening the file. found bug in Netbeans, one lib dependency was not updated correctly lib containd old link to 3.0.1 after manual fix all files are generated correctly works with 3.1 - issue can be closed Sorry for confusion. |