Inventory report template
A long table that continues across pages with a repeating header and a totals row.

What it demonstrates
- A 46 row table that continues onto a second page in print and PDF output
- repeatHeader, zebra and rowBreak avoid
- A status column computed by comparing quantity with a reorder level
- Totals for quantity and stock value in the footer
Rendered with the screen target. In print and PDF output page numbers show the real total and long tables continue onto further pages. See pagination.
Use it
import { renderDocument } from 'docstudio';
import template from './template.json' with { type: 'json' };
import data from './data.json' with { type: 'json' };
const result = renderDocument(template, data, { target: 'print' });
if (!result.ok) {
throw new Error(result.diagnostics.map((item) => item.message).join('; '));
}
const html = result.html;Get the files
Copy the template and the sample data as JSON, save them as template.json and data.json, and use the snippet above to render them.