Jump to content
Changes to the Jaspersoft community edition download ×

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


ikhatkhatay

Recommended Posts

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).

converted-file.png.eb49d9fb298c99a466739f15a9ac996f.png

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).

converted-file.png.00be851547d9b1554baf5131d659a363.png

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!

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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.
 

Link to comment
Share on other sites

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-dynamically

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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...