Excel Row Height Does Not Auto-Size When Stretch Type = 'Relative to Tallest Object'

I am using Jaspersoft Studio v6.3.1.final to generate an Excel report.

  1. Multiple source data rows can be combined into one output row
  2. The detail row has a minimum row height of 50 pixels
  3. All cells on the detail row are contained in a Frame
  4. 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!

ikhatkhatay's picture
Joined: Feb 23 2021 - 10:27am
Last seen: 2 months 1 week ago

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.

mrajkuma - 3 months 3 weeks ago

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"/>


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.

Binary Data row_height_fixed.jrxml50.2 KB
darth_fader's picture
Joined: Mar 7 2010 - 9:45pm
Last seen: 3 months 2 weeks ago

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.

Package icon row_height.zip81.92 KB
ikhatkhatay's picture
Joined: Feb 23 2021 - 10:27am
Last seen: 2 months 1 week ago