I am using Jaspersoft Studio v6.3.1.final to generate an Excel report.
- Multiple source data rows can be combined into one output row
- The detail row has a minimum row height of 50 pixels
- All cells on the detail row are contained in a Frame
- All cells on the detail row are set to Stretch Type = 'Relative to Tallest Object'
The "tallest" object in this report is usually Column B and its contents are populated through a formula-based variable. Although this variable acts on each source data row, all the source data rows which are combined into one output row have the same variable value.
The Preview shows the row height adjusted to accommodate the "tallest" generated data (Column B in this case).
However, the generated Excel report does not adjust the row height as expected. As a result, the generated data appears truncated (data is contained in Column B but the visual cuts off some of the lines/words).
I am looking to understand why the generated Excel report does not expand the row height to accommodate the generated data as seen in the Preview. The documentation does mention that variable-based cells do not "resize" from the "initial value". In this Use Case, no "resizing" takes place; the "final value" is the same as the "initial value".
Attached are the example template (JRXML and JASPER), example data source (JSON), and example Excel report (XLSX). Thanks!
2 Answers:
The recommended fix in the wiki is to add the following property to each text field in the detail band -Â
Â
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
https://community.jaspersoft.com/wiki/how-expand-excel-cell-height-dynam...
I tested that out, works pretty well - see the attached file. Might be a way to do this on a group basis by adding those text fields to an element group or frame, didn't test that out.
Attachment | Size |
---|---|
![]() | 50.2 KB |
Thanks you so much, @darth_fader! The solution works for the report in isolation. However, I've been testing multiple Use Cases and am still running into the same issue. After additional investigations and troubleshooting, I discovered that the parent file contains an image and this somehow prevents the row height auto-adjust from working.
I am attaching a ZIP file with the relevant files.
Without logo
With logo
Please advise.
Attachment | Size |
---|---|
![]() | 81.92 KB |
Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
Â