Bug 63402 - XSSFSheet.removeTable corrupts the workbook
Summary: XSSFSheet.removeTable corrupts the workbook
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-04 17:15 UTC by David Gauntt
Modified: 2019-07-01 14:23 UTC (History)
0 users



Attachments
JUnit test case to illustrate bug 63401 (4.38 KB, text/plain)
2019-05-04 17:17 UTC, David Gauntt
Details
Initial attempt at a fix (2.97 KB, patch)
2019-07-01 14:23 UTC, Dominik Stadler
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.