FreeReportv0.9.0한국어

Groups and subtotals

Group rows by a field, print group headers and footers with subtotals, start each group on a new page and repeat headers.

A group collects consecutive rows with the same value. Aggregates in its header and footer cover the group; in the page footer they can cover the page; anywhere you can ask for the whole report.

"groups": [{
  "by": "region", "sort": "asc", "repeatHeader": true, "keepWithRows": 2,
  "header": { "height": 7, "elements": [
    { "type": "text", "x": 0, "y": 0, "w": 180, "h": 7, "text": "■ {region} ({count()}건)", "style": { "bold": true } }
  ] },
  "footer": { "height": 7, "elements": [
    { "type": "text", "x": 0, "y": 0, "w": 140, "h": 7, "text": "{region} 소계", "style": { "align": "center" } },
    { "type": "field", "x": 140, "y": 0, "w": 40, "h": 7, "expr": "sum(amount)", "format": "#,##0", "style": { "align": "right" } }
  ] }
}],
"pageFooter": { "height": 7, "elements": [
  { "type": "text", "x": 0, "y": 1, "w": 180, "h": 6, "text": "이 페이지 소계 {sum(amount, 'page'):#,##0}원 · 누계 {sum(amount, 'report'):#,##0}원" }
] }
NameTypeDescription
byExprExpression that groups consecutive rows, e.g. "region".
sort'asc' | 'desc'Sort rows by the group expression first (otherwise rows keep their order).
header / footerBandPrinted before / after each group; aggregates cover the group.
newPagebooleanEach group starts on a new page.
repeatHeaderbooleanRepeat the group header on pages where the group continues.
keepWithRowsnumberKeep the header with at least this many rows (default 1).
resetPageNumberbooleanRestart page / pages for each group.