Autofilter in Excel output from JasperReports Server not working

I can get the Autofilter to work when I run a report in JasperSoft Studio, however when I run the same report from JasperReports Server, the Autofilter does not appear.

Is there any special configuration I need for Autofilter to work from JR Server

Im using JasperSoft Studio 6.1 and JasperReport Server 6.0.1


import;                                                                                                                     import net.sf.jasperreports.engine.JRException;                                                                                          import net.sf.jasperreports.engine.JRExporterParameter;                                                                                  import net.sf.jasperreports.engine.JasperPrint;                                                                                          import net.sf.jasperreports.engine.export.JRXlsExporter;                                                                                 import net.sf.jasperreports.engine.export.JRXlsExporterParameter;                                                                        import net.sf.jasperreports.engine.util.JRLoader;
public class Report {                                                                                                                        public void generateReport() throws JRException, Exception {                                                                                    /*JasperPrint generated from JasperReport Server*/                                                                                       /*{jasperReport}.jrprint*/                                                File file = new File ("/home/{user}/Desktop/{file}.jrprint");                                                                            JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(file);                                                                       File destFile = new File("/home/{user}/Desktop/{file}.xls");                                                                             JRXlsExporter exporter = new JRXlsExporter();                                                                                                                                                                                                                                     exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);                                                                    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());                                                        exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);                                                    exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.FALSE);                                                        exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS,Boolean.FALSE);                                                          exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);                                           exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS,Boolean.TRUE);                                        exporter.exportReport();                                                                                                                 /*that is working*/                                                                                                               }                                                                                                                                    }

guilherme_ls's picture
Joined: May 13 2015 - 10:01am
Last seen: 7 years 3 months ago

1 Answer:

First, you should be using the same version of Jaspersoft Studio as JasperReports Server.

I just tried using autofilter with 6.1.0 and it worked without any problem. You need to export as xls from JasperReports Server because autofilter only works with xls and not html.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago