bojan.subotic Posted March 12, 2015 Share Posted March 12, 2015 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 Link to comment Share on other sites More sharing options...
ngocdien Posted March 23, 2015 Share Posted March 23, 2015 I got the same error even after recompiled all reports using v.6.0.3. Any solution? Thanks, Truong Link to comment Share on other sites More sharing options...
1021866588 Posted May 6, 2016 Share Posted May 6, 2016 I got the same error . Any solution? Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks,Thanks, Link to comment Share on other sites More sharing options...
franky4 Posted May 12, 2017 Share Posted May 12, 2017 As a workaround you can export XLSX instead of XLS. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now