Jasper Report Export to excel is not working when report name has special character

0

Problem Statement

Jasper Report Export to excel is not working when report name has special character.

Report name : Test: Sample report

Report Id: test_sample_report

getting error as below. I can get it corrected by changing removing the column : to space, but is there a configuration I can use the sheet name as report id.

I am currently using 7.2.0, this used to work fine in previous release 5.4 


Error Message

Invalid char : found at index (4) in sheet name 'Test: Sample report'

Error Trace

java.lang.IllegalArgumentException: Invalid char : found at index (4) in sheet name 'Test: Sample report''
 at org.apache.poi.ss.util.WorkbookUtil.validateSheetName(WorkbookUtil.java:153)
 at org.apache.poi.hssf.record.BoundSheetRecord.setSheetname(BoundSheetRecord.java:94)
 at org.apache.poi.hssf.model.InternalWorkbook.setSheetName(InternalWorkbook.java:530)
 at org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:817)
 at net.sf.jasperreports.engine.export.JRXlsExporter.createSheet(JRXlsExporter.java:338)
 at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportSheet(JRXlsAbstractExporter.java:1275)
 at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportPage(JRXlsAbstractExporter.java:890)
 at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:837)
 at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:687)
 at com.jaspersoft.jasperserver.war.action.ReportExcelExporter.export(ReportExcelExporter.java:126)
 at com.jaspersoft.jasperserver.war.action.Abstr

mrakeshpl's picture
Joined: Nov 21 2019 - 9:33am
Last seen: 3 weeks 3 days ago

1 Answer:

0

Special characters in report names will give problems when export to excel. We know about this and was reported as a defect from 6.x onwards but it hasn't been fixed yet. Apart from removing it from the name, I am not aware of any other workarounds.

vchiem's picture
7330
Joined: May 1 2017 - 5:33pm
Last seen: 2 days 17 hours ago
Feedback
randomness