Steps to Reproduce
<div id="parent" height="100%" apply="ticket.Kk6TestComposer"> <div> <button id="do" label="reproduce"/> </div> <spreadsheet id="ss" width="100%" vflex="1" showContextMenu="true" showSheetbar="true" showToolbar="true" showFormulabar="true" showSheetTabContextMenu="true" src="${empty param.file?'/WEB-INF/books/blank.xlsx':param.file}" ignoreAutoHeight="true" /> </div>
Ranges.range(ss.getSelectedSheet(), "A1").setCommentRichText("test"); Ranges.range(ss.getSelectedSheet(), "A2").setCommentRichText("test2"); exportExcel();
- click reproduce button
Current Result
io.keikai.range.impl.imexp.ExportException: Fail to export comment in sheet Sheet1 from book blank.xlsx
at io.keikai.range.impl.imexp.AbstractExcelExporter.export(AbstractExcelExporter.java:338)
at io.keikai.api.impl.ExporterImpl.export(ExporterImpl.java:52)
at ticket.Kk6TestComposer.exportExcel(Kk6TestComposer.java:47)
at ticket.Kk6TestComposer.reproduce(Kk6TestComposer.java:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:673)
at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3170)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3140)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3082)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1888)
at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1660)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1323)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:528)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:404)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:412)
...
Caused by: java.lang.NullPointerException
at org.apache.poi.xssf.model.CommentsTable.findAuthor(CommentsTable.java:176)
at org.apache.poi.xssf.usermodel.XSSFComment.setAuthor(XSSFComment.java:94)
at io.keikai.range.impl.imexp.AbstractExcelExporter.exportCell(AbstractExcelExporter.java:804)
at io.keikai.range.impl.imexp.AbstractExcelExporter.exportRow(AbstractExcelExporter.java:677)
at io.keikai.range.impl.imexp.AbstractExcelExporter.exportRowColumn(AbstractExcelExporter.java:619)
at io.keikai.range.impl.imexp.ExcelXlsxExporter.exportRowColumn(ExcelXlsxExporter.java:1974)
at io.keikai.range.impl.imexp.AbstractExcelExporter.export(AbstractExcelExporter.java:293)
Expected Result
no error
Debug Information
- author field in Cell is null by default
Workaround
AbstractExcelExporter.exportCell()
Optional.ofNullable(comment.getAuthor()).ifPresent(poiComment::setAuthor);