jasper-software / jasper

Official Repository for the JasPer Image Coding Toolkit
http://www.ece.uvic.ca/~mdadams/jasper
Other
223 stars 101 forks source link

Error when using JRParameter API calls with new exporter configuration #255

Closed Syafiq-lab closed 3 years ago

Syafiq-lab commented 3 years ago

I create a code where I can create a xlsx file with jasper. I create an instance to configure the file and in the call, I create an extra parameter where I'm using virtualizer to handle the workload. When the system not using virtualizer, I can download the file successfully, however, the error pop up when I'm trying to using virtualizer. I don't know where is wrong since JRParameter is not deprecated for jasper 6.16

Error Caused by: net.sf.jasperreports.engine.JRRuntimeException: Can't mix deprecated JRParameter API calls with new exporter configuration API calls. at net.sf.jasperreports.engine.JRAbstractExporter.checkApi(JRAbstractExporter.java:309) at net.sf.jasperreports.engine.JRAbstractExporter.setParameter(JRAbstractExporter.java:345) at org.springframework.ui.jasperreports.JasperReportsUtils.render(JasperReportsUtils.java:109) at

Method call ReconReportData obj= new ReconReportData(); list2.add(0, obj); if( list2.size() > 50000) { JRAbstractLRUVirtualizer virtualizer = null; virtualizer = new JRGzipVirtualizer(10); parameterMap.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); } // JRDataSource JRdataSource = new JRBeanCollectionDataSource(list2); JRDataSource rhbJRDataSource = new RhbJRDataSource<ReconReportData>(list2.iterator(), map); parameterMap.put("Table_Title", "Myclear Recon Transaction Detail Report (XLS)"); parameterMap.put("Table_Data_Source", rhbJRDataSource);

Config `public class JasperReportsXlsxView extends AbstractJasperReportsSingleFormatView {

@Override
protected JRXlsxExporter createExporter() {
    JRXlsxExporter xlsxExporter = new JRXlsxExporter();
    SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
    configuration.setOnePagePerSheet(true);
    configuration.setRemoveEmptySpaceBetweenColumns(true);

    xlsxExporter.setConfiguration(configuration);
    //Remove deprecated code for java 8

// JRXlsxExporter xlsxExporter = new JRXlsxExporter(); // xlsxExporter.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); // xlsxExporter.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); return xlsxExporter; }`

jubalh commented 3 years ago

The second time someone comes here asking for support for JasperReport. What is wrong with you people? Did you not take a single look at what this repository and project is about? Is it so hard to read "Official Repository for the JasPer Image Coding Toolkit " in the description? Is it so hard to look at the README?