Jump to content

Autofilter in Excel output from JasperReports Server not working


guilherme_ls

Recommended Posts

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 java.io.File;                                                                                                                     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*/                                                                                       /*http://192.168.1.106:8080/jasperserver/rest_v2/reports/reports/{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*/                                                                                                               }                                                                                                                                    }[/code]

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

Link to comment
Share on other sites

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...