Bug 66211 - XSSFTable.updateHeaders will not work for Worksheets created using current Excel versions
Summary: XSSFTable.updateHeaders will not work for Worksheets created using current Ex...
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 5.2.2-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2022-08-13 14:05 UTC by Axel Richter
Modified: 2022-09-12 13:16 UTC (History)
0 users

Sample file created using Excel 365 (10.35 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2022-08-13 14:49 UTC, Axel Richter

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 PJ Fanning 2022-08-13 14:34:44 UTC
Thanks Axel. I've added r1903390. Would you have the dummy_template.xlsx file from https://stackoverflow.com/questions/55532006/renaming-headers-of-xssftable-with-apache-poi-leads-to-corrupt-xlsx-file/55539181#55539181 ? I'd like to try to add a test case.
Comment 2 Axel Richter 2022-08-13 14:49:23 UTC
Created attachment 38364 [details]
Sample file created using Excel 365
Comment 3 PJ Fanning 2022-08-13 15:09:55 UTC
added test case with r1903393
Comment 4 Dominik Stadler 2022-09-12 12:53:08 UTC
This caused a few regressions in the mass-regression-test, e.g. the file at http://people.apache.org/~centic/poi_regression/reports/binaries.templates.cdn.office.net_support_templates_es-es_tf16410091_win32.xltx.xlsx processed via XSSFFileHandler will fail now.

Do we need a more advanced validation-logic here?
Comment 5 PJ Fanning 2022-09-12 13:04:13 UTC
This regression seems to happen with o.a.p.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:710)

I think we've hit a few issues cloning sheets with charts.
Comment 6 PJ Fanning 2022-09-12 13:16:02 UTC
I tried this test but it won't fail.

    void testRegression66211() throws Exception {
        File file = XSSFTestDataSamples.getSampleFile(
        try (
                FileInputStream fis = new FileInputStream(file);
                XSSFWorkbook workbook = new XSSFWorkbook(fis)
        ) {
            XSSFFormulaEvaluator formulaEvaluator = workbook.getCreationHelper().createFormulaEvaluator();
            XSSFSheet newSheet0 = workbook.cloneSheet(0);
            XSSFSheet newSheet1 = workbook.cloneSheet(1);
            XSSFSheet newSheet2 = workbook.cloneSheet(2);