Hi,
Up until jasperreports 6.0.0 everything was just fine and then it started to throw exception: "java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFCellStyle.setShrinkToFit(Z)V" when we tried to export jasper as xls file. We have a simple code that exports jsprerreport as xls file in a stream. What went wrong?
public byte[] renderXls(JasperPrint print, boolean demo) throws Exception {
byte[] bytes = null;
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
JRXlsExporter exporter = new JRXlsExporter();
exporter.setExporterInput(new SimpleExporterInput(print));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(
stream));
if (demo) // Demo verzija
{
SimpleXlsxReportConfiguration sxrc = new SimpleXlsxReportConfiguration();
sxrc.setEndPageIndex(0);
exporter.setConfiguration(sxrc);
}
exporter.exportReport();
bytes = stream.toByteArray();
} catch (Exception e) {
throw new Exception(e.getMessage());
}
return bytes;
}
Thanks.
Best regards.
Bojan