Business report template

KPI tiles, a results table with attainment percentages and a bulleted highlights list.

A rendered quarterly business report with three KPI tiles, a regional table and a highlights list

What it demonstrates

  • KPI tiles calculated with sum, avg and count over a data array
  • A table with a percent formatter and a totals row
  • A repeater that renders one paragraph per highlight
  • A running header and page numbers

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

render.ts
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.