Jump to content
We've recently updated our Privacy Statement, available here ×

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


Recommended Posts


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(

            if (demo) // Demo verzija
                SimpleXlsxReportConfiguration sxrc = new SimpleXlsxReportConfiguration();

            bytes = stream.toByteArray();
        } catch (Exception e) {
            throw new Exception(e.getMessage());

        return bytes;



Best regards.


Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...
  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...