jx:autoRowHeight
jx:autoRowHeight adjusts the row height after content is written to fit wrapped text. Without this, rows with long text content may appear truncated.
Syntax
Section titled “Syntax”jx:autoRowHeight(lastCell="C1")Attributes
Section titled “Attributes”| Attribute | Description | Required |
|---|---|---|
lastCell | Bottom-right cell of the command area | Yes |
When to use this
Section titled “When to use this”Use it when your template cells have word wrap enabled and the data may contain text of varying lengths. Without auto-fitting, Excel uses the row height from the template, which may be too short for longer content.
Example
Section titled “Example”Template cell A1 comment:
jx:autoRowHeight(lastCell="C1")After XLFill writes the cell content, it recalculates the row height so all wrapped text is visible.
Inside loops
Section titled “Inside loops”Combine with jx:each to auto-fit every generated row:
Cell A1 comment: jx:area(lastCell="C1") jx:each(items="items" var="e" lastCell="C1")
Cell A1 also has: jx:autoRowHeight(lastCell="C1")Each row gets its height adjusted based on its content.
That’s every command in XLFill. You now know the full template language. For most reports, you’ll use jx:area + jx:each and occasionally jx:if. The rest are there when you need them.
Try it
Section titled “Try it”Download the runnable example: template t17.xlsx | output 17_autorowheight.xlsx | code snippet
What’s next?
Section titled “What’s next?”Learn how formulas in your templates are automatically expanded when rows are inserted: