i have the following report with a main and a subreport.
Is there a simple way to export this document (which is layouted for a PDF) directly to excel? Or is only the possibility to change the complete layout?
Thanks for a short feedback and helpful answers.
You have two options:
1) rework your layout to support both pdf and excel by remove all white space in bands, deleting unused bands, ignoring graphics, and adding configuration parameters for excel output such as those found here:
For example: see net.sf.jasperreports.export.xls.detect.cell.type
2) create a separate report template optimized for each output type
I typically go with option two; PDF output deals with a fixed page width/height and printer friendly concerns, excel really doesn't. That alone can require significant differences in layouts. And if your requirements evolve, say now you need to create multiple worksheets in excel but need images etc for pdf, you may be forced at that point to create multiple templates. But like I mentioned, it comes with overhead. If I make a change in logic or computation and need consistent results across output formats, that change needs to be made in multiple places.
Option one may or may not be simple, export your current report to excel as is and review the results. you may notice many extra columns and rows in excel and eliminating those can be tedious. In my experience it can be done but can be a pain. Also you have to filter out images, fonts, etc., enable cell type detection, check to see if things still work as expected in pdf output, so on and so on.