java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFCellStyle.setShrinkToFit(Z)V

0

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

bojan.subotic's picture
Joined: Nov 21 2014 - 2:06am
Last seen: 4 years 8 months ago

3 Answers:

0

I got the same error even after recompiled all reports using  v.6.0.3.  Any solution?  Thanks, Truong

ngocdien's picture
-120
Joined: Mar 4 2015 - 11:08am
Last seen: 4 years 8 months ago
0

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,

1021866588's picture
Joined: Mar 17 2016 - 6:13am
Last seen: 3 years 6 months ago
0

As a workaround you can export XLSX instead of XLS.

franky4's picture
46
Joined: Jan 5 2016 - 2:15am
Last seen: 1 day 14 hours ago
Feedback