Skip to content

jx:group

jx:group creates Excel outline grouping on the output rows, giving users the ability to expand and collapse sections. Ideal for hierarchical reports, department breakdowns, and any template where detail rows should be hideable.

jx:group(lastCell="D1" collapsed="false")
jx:group(lastCell="D1" collapsed="true")
AttributeRequiredDescription
lastCellYesBottom-right cell of the group area
collapsedNoWhether the group starts collapsed (default: false)

Use it when your report has hierarchical structure that users should be able to drill into:

  • Department summary with expandable employee details
  • Quarterly totals with collapsible monthly breakdowns
  • Category headers with hidden line items
  • Executive summary that expands into full detail

Example: Departments with expandable employees

Section titled “Example: Departments with expandable employees”
Cell A1 comment:
jx:area(lastCell="D20")
jx:each(items="departments" var="dept" lastCell="D5")
Cell A2 comment:
jx:each(items="dept.Employees" var="e" lastCell="D2")
jx:group(lastCell="D2" collapsed="false")

Row 1 contains ${dept.Name} (the department header). Rows 2+ contain ${e.Name}, ${e.Title}, etc. The jx:group wraps the employee rows in an outline group. In the output, users see the [+]/[-] controls in the row gutter to expand/collapse each department’s employees.

For executive summaries where detail should be hidden initially:

jx:group(lastCell="D1" collapsed="true")

The group starts collapsed. Users see only the summary rows and can click to expand when they need details.

Excel supports up to 8 levels of outline nesting. Nest jx:group commands to create multi-level hierarchies:

Cell A1 comment:
jx:each(items="regions" var="region" lastCell="D10")
Cell A2 comment:
jx:each(items="region.Departments" var="dept" lastCell="D5")
jx:group(lastCell="D5")
Cell A3 comment:
jx:each(items="dept.Employees" var="e" lastCell="D3")
jx:group(lastCell="D3")

Region > Department > Employee — each level independently collapsible.

jx:group uses deferred execution. The group ranges are recorded during template processing and applied after all rows are written, ensuring correct row references even when loops expand the output.

Add charts to visualize your data:

jx:chart →