JasperReports JRXML format uses its own formatting which is different from Excel and so when you want to export to Excel directly from iReport for example two things are going to happen:
- Probably you will have no formatting rule available and you will end up with an approximation of the real formatting you are after
- Your raw data could disappear and you get in the Excel output just exacty what the formatting in JRXML is specifying
When my attention was brought to this problem by a member of my current team I saw a post with some solutions I did not like.
The reason why I did not like the solutions (besides the fact they are not addressing the two points I described above) is that they basically violate separation of concerns.
The solution for this problem is indeed addressing the problem from the right angle.
It allows to format anything for non excel output from iReport (jrxml). It then relies on mapping to translate the custom jrxml format to the proprietary to Excel syntax when that format is needed.
I only came to that post after some research and the more I research the more convince I am people get easily lost nowadays when searching for solutions on the web. This is of course a result of a non semantic web markup and consequently a poor search engine filtering. Still there is something that can be done if you stick to concepts and you refine your terms following them.
Here is my personal story when I researched this issue. This could probably help others. Remember do never get the first response you get from Google as the final response to your problem:
I found a similar issue within the JasperReports forums, not from Google. Then I asked if a solution was found
I realized using JRXlsAbstractExporter was apparently the way to go.
And so I finally got it.
- As this is a solution addressable only from the JR Excel API Exporter, if you are really stuck with POI Exporter then what to do? I could not find anything but as I knew from simple concept this was a task to be done by the exporter and the exporter uses the POI API then I searched for the necessary formatting and I got into this post
I feel like posting how you research is as useful as posting a solution. A good researcher cannot give up. A path must be follow till the end which is a Proof Of Concept (POC). There is no other way.
If you are the architect you must do that job. If you are the CTO be sure you do it yourself or have an architect to delegate to. If you are a developer and you do this you are on your way to become a good architect and a good hands on CTO.