When attempting to Export the XML of attached xlsx, there occurs following exception: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at org.apache.poi.xssf.extractor.XSSFExportToXml.exportToXML(XSSFExportToXml.java:203) at org.apache.poi.xssf.extractor.XSSFExportToXml.exportToXML(XSSFExportToXml.java:109) The reason is, that one column of the table isn't mapped. When I do the export from Excel, it works. There is a different handling between Excel and Apache POI. The code for exporting the XML is as following: XSSFWorkbook wb = /*given from previous code execution*/; for (XSSFMap map : wb.getCustomXMLMappings()) { XSSFExportToXml exporter = new XSSFExportToXml(map); ByteArrayOutputStream os = new ByteArrayOutputStream(); exporter.exportToXML(os, true); }
Created attachment 35119 [details] [PATCH] proposed patch including testcase
Comment on attachment 35119 [details] [PATCH] proposed patch including testcase Mark patch as obsolete, as the solution is not complete
Created attachment 35120 [details] xlsx which ends up in a IndexOutOfBoundsException
added guard in https://svn.apache.org/viewvc?view=revision&revision=1801634
Thanks for your fast fix. unfortunately, it just gets rid of the exception, but doesn't provide the same behaviour as the export in Excel does. ==> Reopen Please see attached patch that has a testcase illustrating the Problem and a proposed fix.
Created attachment 35122 [details] Proposed fix that provides same behaviour as excel
Hi Daniel - any chance you could do a Github Pull Request? https://github.com/apache/poi
Latest patch applied using https://svn.apache.org/viewvc?view=revision&revision=1801721