problems exporting xls if jasperreports1.3.1

srtash
2007-03-02
2013-04-16
  • srtash

    srtash - 2007-03-02

    I recently upgraded my environment to JasperReports 1.3.1.  When I try to export a report as XLS through SWTJasperViewer I see the following exception:

    java.lang.reflect.InvocationTargetException
        at com.jasperassistant.designer.viewer.actions.AbstractExportAction$1.run(AbstractExportAction.java:135)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
    Caused by: java.lang.NoSuchFieldError: IS_ONE_PAGE_PER_SHEET
        at com.jasperassistant.designer.viewer.actions.ExportAsSingleXlsAction.exportWithProgress(ExportAsSingleXlsAction.java:71)
        at com.jasperassistant.designer.viewer.actions.AbstractExportAction$1.run(AbstractExportAction.java:132)
        ... 1 more

    Here is the SWTJasperViewer's ExportAsSingleXlsAction code that is throwing the exception:

        /**
         * @see com.jasperassistant.designer.viewer.actions.AbstractExportAction#exportWithProgress(java.io.File, net.sf.jasperreports.engine.export.JRExportProgressMonitor)
         */
        protected void exportWithProgress(File file, JRExportProgressMonitor monitor)
                throws JRException {
            JRXlsExporter exporter = new JRXlsExporter();
            exporter.setParameter(JRExporterParameter.JASPER_PRINT, getReportViewer().getDocument());
            exporter.setParameter(JRExporterParameter.OUTPUT_FILE, file);
            exporter.setParameter(JRExporterParameter.PROGRESS_MONITOR, monitor);
    ---------->    exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
            exporter.exportReport();
        }

    Evidently the JRXlsExporter class no longer supports JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET. Are there any plans to fix the ExportAsSingleXlsAction class in SWTJasperViewer so that it no longer makes this call?

    Cheers,
    Steve

     
    • hsim

      hsim - 2007-04-02

      Yes, it is a funny problem which I also came across. And it comes not only with jasper-1.3.1 but also other version such as 1.3.0 and 1.2.4, with which I also tested. But I don't think the reason is 'the JRXlsExporter class no longer supports JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET', as you have claim above, for IS_ONE_PAGE_PER_SHEET is still supported in the latest release of Jasper and not be deprecated.

      My solution is recompile it with my project and Jasper 1.3.1, and then jar it separately. It may not be a graceful method and a bit awkward. But it works!

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks