Jasper Reports: Problem with Excel-Output

Questions and answers on developing, deploying and using plugins and JavaBeans

Jasper Reports: Problem with Excel-Output

Postby Bernd.N » Mon Mar 27, 2017 3:27 pm

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.
Last edited by Bernd.N on Mon Mar 27, 2017 7:52 pm, edited 1 time in total.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Jasper Reports: Problem with Excel-Output

Postby Bernd.N » Mon Mar 27, 2017 3:52 pm

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.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Jasper Reports: Problem with Excel-Output

Postby patrick » Mon Mar 27, 2017 4:51 pm

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.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3594
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Jasper Reports: Problem with Excel-Output

Postby Bernd.N » Mon Mar 27, 2017 5:17 pm

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.)
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Jasper Excel Example

Postby Bernd.N » Tue Mar 28, 2017 6:10 am

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 565 times
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 474
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 4 guests

cron