Skip to content

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.

jx:autoRowHeight(lastCell="C1")
AttributeDescriptionRequired
lastCellBottom-right cell of the command areaYes

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.

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.

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.

Download the runnable example: template t17.xlsx | output 17_autorowheight.xlsx | code snippet

Learn how formulas in your templates are automatically expanded when rows are inserted:

Formulas →