Summary: | removeColumn corrupts XSSFTable | ||
---|---|---|---|
Product: | POI | Reporter: | David Gauntt <dmgauntt> |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 4.0.0-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
JUnit test case to illustrate bug 62759
Patch to XSSFTable.removeColumn() |
Description
David Gauntt
2018-09-25 19:22:56 UTC
Created attachment 36566 [details] JUnit test case to illustrate bug 62759 This JUnit test class will write 3 Excel workbooks to build/custom-reports-test. Each workbook is created by adding a 4 column, 3 row table starting at cell $C$3 of the first worksheet. Then one column is removed from the table. In one of the workbooks, it is the first column, in one of the workbooks it is the last column, and in one it is the penultimate (second to the last) column. JUnit passes the tests but the workbooks are corrupted. When the workbooks are opened in Excel 2010 it repairs the workbooks by deleting the table. I will post a patch shortly. Created attachment 36567 [details]
Patch to XSSFTable.removeColumn()
This patch updates the area reference of the table after removing the column, and shifts the cells in the table appropriately.
If the column to be removed is the last column, then the cells in the last column are deleted. Otherwise, the cells in the column to be removed are deleted, and the cells to their right are shifted one cell to the left. In either case, cells outside the table are unaffected.
Note that this does not update any references to the cells.
|