Marek D. Posted November 28 Posted November 28 (edited) I would like to export a complex Jasper report containing multiple columns, which need to auto-fit to column widths, to Microsoft Excel (.XLSX) format. Everything works fine when exporting to .XLS format. However, when I try exporting to .XLSX, the parameters: <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/> <property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/> seem to be completely ignored - they should stretch the columns width according to the text content inside them - but in .XLSX this obviously does not work. The column widths are not adjusted according to the text content. Instead, they remain unchanged. I have tested this issue across multiple JasperSoft Studio versions, but the problem persists in all of them. Attached are the "problematic" sections of the .jrxml file and the generated outputs in both .XLS (which displays the correct behavior) and .XLSX (where the parameters appear to be ignored, resulting in a distorted output). The data in the attachments has been anonymized for privacy. I would like to know: If this is a known issue or bug. When a fix might be available. If there are any "workaround" solutions to resolve the issue. Thank you in advance for your assistance. JRXML.xml XLSX - wrong.xlsx XLS - correct.xls Edited November 28 by Marek D.
shreekrishna.shankhwar Posted Sunday at 03:32 AM Posted Sunday at 03:32 AM In Jasper Column width will not automatically, You have to adjust the pixel. Height are automatically adjusted as par the property selected
Marek D. Posted Sunday at 07:57 AM Author Posted Sunday at 07:57 AM (edited) I respectfully disagree. Jasper CAN automatically adjust column widths—I have tested this functionality extensively over the years, and it works flawlessly. However, as mentioned earlier, this feature is only supported when exporting to the .XLS (Excel) format and not .XLSX. Secondly, of course not to other formats, such as PDF, Word - for them such a parametr does not exist of course. The Jasper engine itself does not perform the adjustment. It simply instructs Microsoft Excel to activate a flag that enables this functionality (you can see that in the attachment). You can refer to the official documentation for confirmation or test on your own. https://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.export.xls.auto.fit.column Additionally, a similar issue has been earlier discussed on this forum (but unfortunatelly was not resolved). Please see the link for more details. Thank you. Edited Sunday at 07:58 AM by Marek D.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now