Exception: Exception in thread "main" java.lang.NullPointerException at org.apache.poi.xssf.model.StylesTable.getNumberFormatId(StylesTable.java:273) at org.apache.poi.xssf.model.StylesTable.putNumberFormat(StylesTable.java:295) at org.apache.poi.xssf.usermodel.XSSFDataFormat.getFormat(XSSFDataFormat.java:52) at org.apache.poi.xssf.usermodel.XSSFCellStyle.cloneStyleFrom(XSSFCellStyle.java:185) at com.genshui.excel.ExcelStyleTest.copyCellStyle(ExcelStyleTest.java:56) at com.genshui.excel.ExcelStyleTest.main(ExcelStyleTest.java:29) it actually happened in org.apache.poi.xssf.model.StylesTable#getNumberFormatId when the map numberFormats has a null value
as usual: please attach the causing Excel file
Created attachment 37693 [details] the causing Excel file the causing Excel file
(In reply to Andreas Beeker from comment #1) > as usual: please attach the causing Excel file the causing Excel file see Comment 2
I wrote a test case that parsed the attached xlsx and tried to clone all its styles and had no issues (latest poi trunk code). In the snippet below, I renamed the test file. ``` void test65065() throws IOException { try (XSSFWorkbook wb = openSampleWorkbook("bug65065.xlsx")) { int size = wb.getStylesSource().getNumCellStyles(); for (int i = 0; i < size; i++) { XSSFCellStyle style = wb.getStylesSource().getStyleAt(i); wb.createCellStyle().cloneStyleFrom(style); } } } ```
Closing as the test passes - reopen if you can provide a broken test scenario