NadeinNick Posted August 25 Share Posted August 25 Hello, I am using Jaspersoft Studio 6.20.5, and I am wondering it is possible to hide Table Header for xlsx files. I have created report, that is used for export to csv and xlsx files, but for xlsx file I don't need table header - first row, and I am wondering it is possible to hide it? I tried following: 1) Pass reportFormat variable through parameters, something like this: private Resource createReport(List<Object> collection, String documentType) { JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(collection); Map<String, Object> parameters = new HashMap<>(); parameters.put("CollectionBeanParam", dataSource); if (CSV.getValue().equalsIgnoreCase(documentType)) { parameters.put(REPORT_FORMAT, CSV.getValue()); JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource()); return writeCsvReport(jasperPrint); } else { parameters.put(REPORT_FORMAT, XLSX.getValue()); JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource()); return writeXlsxReport(jasperPrint); } and the use it in report, by "Print when expression" on row : $P{reportFormat}.equals("csv"), but it doesn't work and I got error when compile report in jasperReport studio: Paramenter not foind: reportFormat --- net.sf.jasperreports.engine.design.JRDesignExpression@70015257 I think it's because tableHeader is rendering before getting reportFormat parameter. 2) Then I tried properties, something like this: <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="pageHeader"/> <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.2" value="tableHeader"/> <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.3" value="pageFooter"/> <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.4" value="lastPageFooter"/> Properties for pageHeader and lastPageFooter works, but properties for tableHeader doesn't. I will appreciate any help. Link to comment Share on other sites More sharing options...
Solution lucianc Posted August 27 Solution Share Posted August 27 Try something like this: <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.x" value="title"/> <property name="net.sf.jasperreports.export.xlsx.exclude.origin.report.x" value="*"/> Regards, Lucian Link to comment Share on other sites More sharing options...
NadeinNick Posted September 16 Author Share Posted September 16 @lucianc thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now