Category: | Bug report |
Priority: | High |
Status: | New |
Project: | Severity: | Major |
Resolution: | Open |
|
Component: | Reproducibility: | Always |
Assigned to: |
Using a full filename (like C:\temp\test), the method JasperFillManager.fillReportToFile() raises an error:
Error saving file : C:\temp\C:\temp\test.jrprint
String _reportsFileBaseName = "C:\\temp\\test"; // filename without extension
JasperDesign jasperDesign = getJasperDesign();
JRXmlWriter.writeReport( jasperDesign, _reportsFileBaseName + ".jrxml", "UTF-8" );
JasperCompileManager.compileReportToFile( jasperDesign, _reportsFileBaseName + ".jasper" );
JasperFillManager.fillReportToFile( _reportsFileBaseName + ".jasper", null, dataSource );
Using relative filename works, but I don't want to store the files in the applications directory (or sub directory).
v5.0.0
JasperFillManager
3 Comments:
Editting the bugreport failes: I get an error: The referenced entity (user: 306070) is invalid.
***
EDIT: It can't work with subdirectories
When I give reportsFileBaseName a relative subdir like this:
String _reportsFileBaseName = "temp\\reports\\test"
JasperFillManager.fillReportToFile() raises an error:
Error saving file : temp\reports\temp\reports\test.jrprint
the files temp\reports\test.jrxml and temp\reports\test.jasper are created as expected
****
I found a workarround. The .jasper file gets an internal name derived from the filename. When the filename contains sub-directories, the name of the jasper report also gets sub-directories. The name property is used to create the .jrprint filename. When the name contains sub-directories ot doubles the parent directorie in its filname.
By setting the name of jasperDesign with the filename (without parent directories) it works.
So in the case above jasperDesign.setName( "test" ); will fix this issue