|Summary:||XSSFSheet.removeTable corrupts the workbook|
|Product:||POI||Reporter:||David Gauntt <dmgauntt>|
|Component:||XSSF||Assignee:||POI Developers List <dev>|
JUnit test case to illustrate bug 63401
Initial attempt at a fix
Description David Gauntt 2019-05-04 17:15:21 UTC
The title says it all. I will attach a JUnit test case that creates a workbook, adds two tables to the first sheet, removes the first table, and then writes the workbook to build/custom-reports-test. JUnit will pass the test, but when the workbook is opened in Excel it will detect a corrupted workbook, and then delete the second table.
Comment 1 David Gauntt 2019-05-04 17:17:35 UTC
Created attachment 36565 [details] JUnit test case to illustrate bug 63401 This test case creates a workbook, adds two XSSFTables to the first sheet, then removes one of the tables, and writes the workbook to build/custom-reports-test. JUnit will pass the test case, but when Excel 2010 opens the workbook it will detect corruption, and remove the second table.
Comment 2 Dominik Stadler 2019-07-01 14:23:01 UTC
Created attachment 36638 [details] Initial attempt at a fix I tried to fix this by removing the table also from the parts-array, but Excel still complains about the file needing repair (although it now can actually recover the table). See attached diff for test-case and code-change that I tried.