Page 1 of 1

Jasper Reports: Problem with Excel-Output

PostPosted: Mon Mar 27, 2017 3:27 pm
by Bernd.N
We use Jasper iReport Designer 5.5.0 to design reports and as plugin jasperreports-6.2.0.jar.
Jasper Reports has an option to create an Excel file instead of an PDF.

Today a customer reported that in such an Excel-output from a Jasper report, a number was missing in a specific column.
In the PDF, that number appeard.

I installed then the MS Office Excel Viewer and tried to do the same.
The Viewer then said when launching that file "File Error. Some number formats might got lost."

Did someone else experience such issues with the Excel-output from a Jasper report?
Because when that is not reliable and does not produce the same output as the PDF in all cases, we have to take away that option from our users.

The number in question was a quite normal "16.00", nothing special, while most (or all) other numbers showed as expected.

Re: Jasper Reports: Problem with Excel-Output

PostPosted: Mon Mar 27, 2017 3:52 pm
by Bernd.N
Ok, I googled "jasper report excel problem" and found several hints, e.g.
http://community.jaspersoft.com/wiki/making-html-xls-or-csv-friendly-reports

Actually the field/cell in question had an overlapping with another field.
Will need to check our reports regarding this point.

Re: Jasper Reports: Problem with Excel-Output

PostPosted: Mon Mar 27, 2017 4:51 pm
by patrick
Sounds more a bit like the number format is the problem, so the string that describes that format. I would have a look inside the report XML and see what is set there.

Re: Jasper Reports: Problem with Excel-Output

PostPosted: Mon Mar 27, 2017 5:17 pm
by Bernd.N
It was the overlapping of two fields. After I corrected that, the field did show also in Excel. Number format is the same for all fields.

The link above describes how one should layout the Jasper report so that it is Excel-friendly.
For example, header fields and row fields need to be completely aligned in a grid layout, otherwise Excel will show much more columns than necessary.

In iReport, one can move the field border towards the next field border, it will snap there. That seems to be ideal also for Excel.
(We still use iReport as that worked much better for us.)

Jasper Excel Example

PostPosted: Tue Mar 28, 2017 6:10 am
by Bernd.N
Here is an example how a Jasper-produced Excel looks when not using a grid layout as mentioned in the link above.
Jasper will produce more columns than just the necessary two columns, in order to put the element positions right:

excel_example.png
excel_example.png (4.31 KiB) Viewed 6944 times