You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.NullPointerException
at org.apache.poi.hssf.record.CFHeaderBase.serialize(CFHeaderBase.java:144)
at org.apache.poi.hssf.record.StandardRecord.serialize(StandardRecord.java:56)
at org.apache.poi.hssf.usermodel.HSSFWorkbook$SheetRecordCollector.serialize(HSSFWorkbook.java:1476)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1523)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1418)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1404)
at org.jxls.transform.poi.PoiTransformer.writeButNotCloseStream(PoiTransformer.java:501)
at org.jxls.transform.poi.PoiTransformer.write(PoiTransformer.java:482)
at org.jxls.util.JxlsHelper.processTemplate(JxlsHelper.java:288)
at org.jxls.util.JxlsHelper.processTemplate(JxlsHelper.java:253)
Reproduction code and file
@Test
public void processTemplate_with_good_data_expected_outputfile() throws FileNotFoundException {
FileTemplaterExcel fileTemplaterExcel = new FileTemplaterExcel();
Map<String, Object> data = new HashMap<>();
DistributeSlipProcessed dist = new DistributeSlipProcessed();
dist.setCategory("ABC");
JtpDistributeDocument doc = new JtpDistributeDocument();
doc.setDocumentTitle("Mon titre");
doc.setDocumentReference("REF04846");
doc.setDocumentVersion("1.0");
doc.setJtpLodToClient("OUI");
dist.setDocuments(List.of(doc, doc));
data.put("distributes", List.of(dist));
FileOutputStream fout = new FileOutputStream("file1.xls");
fileTemplaterExcel.processTemplate("template3.xls", data, fout);
}
Description
A nullpointerexception is thrown when templating.
Reproduction code and file
template3.xls
Solution found
It seems that when a conditionalFormatting is not used, instead of setting an empty list of ranges, it is better to delete it.
Might not be the solution, but changing removeConditionalFormatting in PoiTransformer.java makes it works:
The text was updated successfully, but these errors were encountered: