Skip to content

Commands Overview

Commands are the structural directives in your template. They go in cell comments and control how XLFill processes regions of your spreadsheet — looping, branching, inserting images, merging cells, and more.

Every command follows this pattern:

jx:commandName(attr1="value1" attr2="value2" lastCell="ref")
  • The command name follows jx:
  • Attributes are key="value" pairs
  • Most commands require lastCell — the bottom-right corner of the command’s area
  • The cell containing the comment is the top-left corner

Put multiple commands in the same cell comment, separated by newlines:

jx:area(lastCell="D10")
jx:each(items="employees" var="e" lastCell="D1")

Commands whose areas are strictly inside another command’s area are automatically treated as children. You don’t need to declare nesting explicitly — XLFill figures it out from the geometry.

Here’s every command available, in order of how often you’ll use them:

Core (you’ll use these on every template)

Section titled “Core (you’ll use these on every template)”
CommandWhat it doesPage
jx:areaDefines the template working region. Required on every template.Details →
jx:eachLoops over a collection, repeating rows or columns for each item. The workhorse command.Details →
jx:ifConditionally shows or hides a template area.Details →
CommandWhat it doesPage
jx:gridFills a dynamic grid with headers and data rows. Great for pivot-style reports.Details →
jx:imageInserts an image from byte data. Photos, logos, charts.Details →
jx:mergeCellsMerges cells in a range. Useful for section headers in loops.Details →
jx:updateCellSets a single cell’s value from an expression. For totals and summaries.Details →
jx:autoRowHeightAuto-fits row height after content is written. For cells with wrapped text.Details →

Don’t be overwhelmed by the list. Most real-world templates use just jx:area + jx:each, and occasionally jx:if. The specialized commands are there when you need them, but you can build powerful reports with just the basics.

Start with the most important command — the one you’ll use on every template:

jx:area →

Or jump straight to the loop command that does most of the heavy lifting:

jx:each →