Bands and data regions
A banded report is a stack of horizontal bands. Each band has a height and holds components. Which bands print, how often, and where they break across pages depends on the band’s role.
| Band | Printed |
|---|---|
reportHeader / reportFooter |
once, at the start / end of the report |
pageHeader / pageFooter |
on every page (printOnFirstPage, printOnLastPage to skip) |
body[] static band ("kind": "band") |
once, in order |
data region header / footer |
before / after the rows (repeatHeaderOnEachPage) |
group header / footer |
when the group value changes |
region detail |
once per row |
region children[] |
nested regions after each row |
Data regions
Section titled “Data regions”A data region repeats its detail band for each row of a data source. It can also have a header, a footer, groups, and child regions:
{ "kind": "dataRegion", "id": "orders_region", "dataSource": "orders", "filter": "row.total > 0", "sort": [{ "expression": "row.date", "direction": "desc" }], "repeatHeaderOnEachPage": true, "header": { "id": "head", "height": 7, "components": [] }, "detail": { "id": "row", "height": 6.5, "components": [] }, "footer": { "id": "foot", "height": 8, "components": [] }}filter skips rows where the expression is falsy. sort takes one or more rules. Inside the region’s bands you can use row, rowNumber and rows (all rows after filter and sort).
Band options
Section titled “Band options”| Option | Meaning |
|---|---|
height |
Height in template units. |
canGrow |
Grow to fit components that grow (default true). Ignored for page headers and footers. |
canShrink |
Shrink to the bottom of the visible components (default false). |
visible |
Expression; the band is skipped when it is falsy. |
pageBreakBefore / pageBreakAfter |
Force a new page. |
style |
backgroundColor and border only. |
designColor |
Color of the band in the designer. It has no effect on the report. |
Pagination
Section titled “Pagination”- A band never splits across pages. A band that does not fit moves to the next page; a band taller than a page is clipped, with a warning.
- Page headers and footers take their space on every page first.
- A region header with
repeatHeaderOnEachPagerepeats at the top of each continuation page. - Components with
canGrow(text) can make their band taller, so long text pushes the following bands down.
Example
Section titled “Example”This product catalog repeats its header on every page and shows page numbers in the page footer:
import { ReportViewer } from '@ariana-reports/react';import { productsData, productsTemplate } from './report-data';
export default function ViewerBasic() { return <ReportViewer template={productsTemplate} data={productsData} zoomMode="fitWidth" />;}<script setup lang="ts">import { ReportViewer } from '@ariana-reports/vue';import { productsData, productsTemplate } from './report-data';</script>
<template> <ReportViewer :template="productsTemplate" :data="productsData" zoom-mode="fitWidth" /></template>{ "schemaVersion": 1, "name": "Product catalog", "unit": "mm", "page": { "size": "A4", "orientation": "portrait", "margins": { "top": 12, "right": 12, "bottom": 12, "left": 12 } }, "dataSources": [ { "name": "products" } ], "styles": { "title": { "fontSize": 18, "fontWeight": "bold", "color": "#0f172a" }, "muted": { "fontSize": 9, "color": "#64748b" }, "th": { "fontSize": 9, "fontWeight": "bold", "color": "#ffffff", "backgroundColor": "#334155", "padding": 1.5 }, "td": { "fontSize": 9, "padding": 1.5, "border": { "width": 0.4, "color": "#e2e8f0", "style": "solid", "sides": [ "bottom" ] } }, "num": { "textAlign": "right" }, "sub": { "fontSize": 9, "fontWeight": "bold", "backgroundColor": "#e2e8f0", "padding": 1.5 } }, "reportHeader": { "id": "rh", "height": 18, "components": [ { "id": "title", "type": "text", "x": 0, "y": 0, "width": 186, "height": 9, "text": "Product catalog", "styleName": "title" }, { "id": "sub", "type": "text", "x": 0, "y": 10, "width": 186, "height": 5, "text": "{{ count(products) }} products · printed {{ formatDate(today(), \"d MMMM yyyy\") }}", "styleName": "muted" } ] }, "pageFooter": { "id": "pf", "height": 8, "components": [ { "id": "pf_n", "type": "text", "x": 0, "y": 2, "width": 186, "height": 5, "text": "Page {{ page.number }} of {{ page.count }}", "style": { "fontSize": 8, "color": "#64748b", "textAlign": "right" } } ] }, "body": [ { "kind": "dataRegion", "id": "list", "dataSource": "products", "repeatHeaderOnEachPage": true, "header": { "id": "head", "height": 7, "components": [ { "id": "h1", "type": "text", "x": 0, "y": 0, "width": 28, "height": 7, "text": "SKU", "styleName": "th" }, { "id": "h2", "type": "text", "x": 28, "y": 0, "width": 72, "height": 7, "text": "Product", "styleName": "th" }, { "id": "h3", "type": "text", "x": 100, "y": 0, "width": 34, "height": 7, "text": "Category", "styleName": "th" }, { "id": "h4", "type": "text", "x": 134, "y": 0, "width": 26, "height": 7, "text": "Price", "styleName": "th", "style": { "textAlign": "right" } }, { "id": "h5", "type": "text", "x": 160, "y": 0, "width": 26, "height": 7, "text": "In stock", "styleName": "th", "style": { "textAlign": "right" } } ] }, "detail": { "id": "row", "height": 6.5, "components": [ { "id": "c1", "type": "text", "x": 0, "y": 0, "width": 28, "height": 6.5, "text": "{{ row.sku }}", "styleName": "td" }, { "id": "c2", "type": "text", "x": 28, "y": 0, "width": 72, "height": 6.5, "text": "{{ row.name }}", "styleName": "td" }, { "id": "c3", "type": "text", "x": 100, "y": 0, "width": 34, "height": 6.5, "text": "{{ row.category }}", "styleName": "td" }, { "id": "c4", "type": "text", "x": 134, "y": 0, "width": 26, "height": 6.5, "text": "{{ row.price }}", "styleName": "td", "style": { "textAlign": "right" }, "format": { "type": "currency", "currency": "USD" } }, { "id": "c5", "type": "text", "x": 160, "y": 0, "width": 26, "height": 6.5, "text": "{{ row.stock }}", "styleName": "td", "style": { "textAlign": "right" }, "conditions": [ { "expression": "row.stock < 10", "style": { "color": "#b91c1c", "fontWeight": "bold" } } ] } ] }, "footer": { "id": "foot", "height": 8, "components": [ { "id": "f1", "type": "text", "x": 0, "y": 1.5, "width": 134, "height": 6, "text": "Total stock value", "styleName": "sub" }, { "id": "f2", "type": "text", "x": 134, "y": 1.5, "width": 52, "height": 6, "text": "{{ sum(rows, r => r.price * r.stock) }}", "styleName": "sub", "style": { "textAlign": "right" }, "format": { "type": "currency", "currency": "USD" } } ] } } ]}{ "products": [ { "sku": "SKU-1000", "name": "Wireless mouse 1", "category": "Hardware", "price": 12, "stock": 0 }, { "sku": "SKU-1007", "name": "Mechanical keyboard 1", "category": "Software", "price": 49.99, "stock": 13 }, { "sku": "SKU-1014", "name": "USB-C dock 1", "category": "Services", "price": 87.98, "stock": 26 }, { "sku": "SKU-1021", "name": "Webcam HD 1", "category": "Accessories", "price": 123, "stock": 39 }, { "sku": "SKU-1028", "name": "Monitor stand 1", "category": "Hardware", "price": 160.99, "stock": 52 }, { "sku": "SKU-1035", "name": "Laptop sleeve 1", "category": "Software", "price": 18.98, "stock": 65 } ]}