See https://svn.apache.org/viewvc/poi/tags/REL_5_2_2/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java?view=markup#l778 if (row != null && row.getCTRow().validate()) will never be true when CTRow looks like so: <row r="4" spans="1:3" x14ac:dyDescent="0.25"> CTRow.validate() will return false because of the not known x14ac:dyDescent. See also https://stackoverflow.com/questions/55532006/renaming-headers-of-xssftable-with-apache-poi-leads-to-corrupt-xlsx-file/55539181#55539181 and https://stackoverflow.com/questions/73339524/xssfworkbook-clonesheet-corrupts-workbook-if-sheet-contains-a-table https://stackoverflow.com/questions/73339524/xssfworkbook-clonesheet-corrupts-workbook-if-sheet-contains-a-table contains a fix for XSSFTable.updateHeaders
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.
Created attachment 38364 [details] Sample file created using Excel 365
added test case with r1903393
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?
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.
I tried this test but it won't fail. ``` @Test void testRegression66211() throws Exception { File file = XSSFTestDataSamples.getSampleFile( "binaries.templates.cdn.office.net_support_templates_es-es_tf16410091_win32.xltx.xlsx"); try ( FileInputStream fis = new FileInputStream(file); XSSFWorkbook workbook = new XSSFWorkbook(fis) ) { XSSFFormulaEvaluator formulaEvaluator = workbook.getCreationHelper().createFormulaEvaluator(); formulaEvaluator.evaluateAll(); XSSFSheet newSheet0 = workbook.cloneSheet(0); XSSFSheet newSheet1 = workbook.cloneSheet(1); XSSFSheet newSheet2 = workbook.cloneSheet(2); } } ```