Use this API to make reports from other systems: one report on request, many reports in a batch, or batches on a schedule.
Set PW_API_KEYS="key1,key2" on the server. Send one key with each request:
Authorization: Bearer key1 (or) x-api-key: key1
In production the API refuses all requests when PW_API_KEYS is empty, unless PW_ALLOW_KEYLESS=1: then it answers without a key read-only (list templates, render a saved template; no definition or data in the request, no sign, no batches or schedules: those answer 401 or 403). In next dev it answers without a key, but refuses a keyless write that carries another site's Origin (a page elsewhere cannot use your local server).
A plain key is a service key: it may render, batch and schedule every report. With accounts on (PW_AUTH=users) a key written email|key (for example PW_API_KEYS="svc-key,reports@acme.com|k2") acts as that user: it sees, renders and schedules only what that user may view (permissions below), renders a definition sent in the request only when the user is a designer, and sees only the batches and schedules made with that same key. A disabled or deleted user's key stops working. Batches and schedules remember the key that made them: once a key is out of PW_API_KEYS (a service key or a user's), what it scheduled or queued no longer runs. Every call is in the audit log under the key's id (the first 8 hex of its SHA-256), never the key.
A richtext item's value is an HTML subset (p, div, span, br, b/strong, i/em, u, s/strike/del, sup, sub, ul/ol/li, a[href], h1–h6, inline style with color, font-size, font-weight, font-style, text-decoration, background-color, text-align).
- Only the markup the report author typed is HTML. Everything that comes from evaluation is escaped and shows as text: each
{Fields.x}part of a template, and the result of a value that is one=expression. Mix markup with data with a template:<b>Total</b> {Fields.total}. A quote or;in a field cannot leave the attribute or CSS value it sits in. htmlFromData: trueon the item (designer: "Field values are HTML (trusted data only)") parses evaluated values as markup too. Set it only when the data is trusted. It still goes through the same allow-list: unknown tags are dropped, links must behttp:,https:,mailto:or start with/, and the size limits apply.- Limits: 100,000 characters of markup after interpolation, 32 levels of nesting, 20,000 styled pieces, 5,000 paragraphs and 5,000 line breaks per item. Past a limit the rest is cut and the render warns.
GET /api/v1/templates gives the list of reports (id, name, parameters).
A template value in a request can be:
"loan-statement": the current saved version"loan-statement@3": a saved version fromreports/.history/{ ...definition }: a full report definition in the request
POST /api/v1/render
const res = await fetch('https://reports.example.com/api/v1/render', {
method: 'POST',
headers: { authorization: 'Bearer key1', 'content-type': 'application/json' },
body: JSON.stringify({
template: 'loan-statement',
format: 'pdf', // pdf | xlsx | docx | pptx | html | csv | json (the page model)
parameters: { accountId: 'LN-2025-001982' },
data: { loan: { /* your JSON */ } }, // optional: replaces the data source named "loan"
fileName: 'statement-LN-2025-001982',
}),
});
const pdf = await res.arrayBuffer();Response headers: x-reportwright-pages, x-reportwright-ms, x-reportwright-warnings.
Streaming CSV and Excel. A data CSV (format: 'csv', not csv: 'layout') or an Excel export (format: 'xlsx') of a
report with one table and row-by-row expressions (group and table footers may total with Sum, Count, Avg, Min, Max or
CountRows) streams: rows are read from the source a batch at a time (JSON arrays, CSV, SQLite, PostgreSQL and MySQL cursors),
sorted and grouped through temporary files when needed, and written as they come, so memory stays flat however many rows
(1M rows: well under 300 MB for the render). The answer then has no content-length and x-reportwright-pages: 0. An
Excel table longer than 1,048,576 rows continues on a sheet "Name (2)" with its header rows again (a total whose rows span
two sheets is then a value, not a SUBTOTAL formula). If the
render fails after the first bytes, the CSV ends with a last line #ERROR <reference> and the connection is broken off
(a failed download, never a short file that looks whole); the server's log records the failure's class under that
reference (never its message, which can name a source or a query). Reports the stream cannot do (aggregates in detail rows, Lookup, nested data sets, TopN filters, several
tables) take the usual path, under the usual caps. Limits: PW_STREAM_MAX_ROWS, PW_STREAM_FETCH_MAX_MB,
PW_STREAM_SQL_MAX_MB, PW_SPILL_MAX_MB; PW_STREAM=0 turns streaming off. Design: docs/research/STREAMING-1M.md.
Export options in the body (see EXPORTS.md): ua: true an accessible PDF (PDF/UA-1; with pdfa: true it is PDF/A-2a), formulas: false Excel totals as values instead of live SUBTOTAL formulas, static: true an HTML file without its Tables view. The server link GET /api/reports/:id/pdf takes ?ua=1 (and ?pdfa=1, ?format=, ?formulas=0 for Excel totals as values; formulas are on by default).
Errors are JSON { error, missingParameters? }: 400 for a bad request or missing parameters, 401 for a bad key, 404 for an unknown template.
Renders run in a pool of worker threads, never on the thread that answers requests. When the server is full the answer comes at once, with a Retry-After header (seconds): 429 when too many of your own renders are waiting, 503 when the queue is full or the wait would be longer than PW_RENDER_MAX_WAIT_MS. 504 when a render ran past the time limit (PW_RENDER_TIMEOUT_MS, which covers reading the template, fetching data, layout and export). Wait Retry-After seconds before you try again.
GET /api/v1/health (a service key, or an admin's key with accounts on): the render pool's workers (size, alive, ready, busy), queue depth by class (interactive, background), the estimated wait in ms, and totals since start (done, failed, rejected, timedOut, crashed, recycled, dropped). The answer is { ok, uptimeS, rssMB, render }. render.arriving counts renders that have arrived but not yet reached the queue (body, auth and template still being read); the admission check counts them too.
GET /api/v1/livez:{ ok: true }while the process answers. No key.GET /api/v1/readyz:{ ok, checks: { storage, workers } }. 200 when storage answers a read within 3 s and a render worker is ready (or renders run on the request thread); 503 otherwise. No key.GET /api/v1/metrics: Prometheus text (renders by outcome, a render duration histogram, queue depth, workers, memory, HTTP answers). A service key, or an admin's key with accounts on, as for/health.GET /api/v1/cron: one scheduler tick plus the batch queue, for hosts without a long-lived process (Vercel Cron). NeedsAuthorization: Bearer $CRON_SECRET; the secret must be at least 16 characters, and without it the route answers 404. Idempotent.
| Route | What it does |
|---|---|
GET /api/auth/me |
{ email, role } of the signed-in user, or 401. |
GET /api/auth/oidc/start, GET /api/auth/saml/login |
Start an OIDC or SAML sign-in (?next=/path). |
GET /api/auth/saml/finish |
Completes the SAML sign-in begun in this browser (?h=). |
GET, DELETE /api/account/devices |
The signed-in user's known browsers; DELETE { id } removes one. Only for the user themselves. |
/api/data/proxy |
REST proxy for data sources. Only hosts in PW_PROXY_ALLOW, at every redirect, never a private address. |
POST /api/data/sql/build |
Designers only. Turns the visual builder's query into one SELECT for the connection's dialect. Runs nothing. |
GET /api/data/sql/schema?connection= |
Designers only. Tables, columns and relations of a SQL connection, read through its read-only login. |
/api/sample/hard, /api/sample/torture, /api/sample/sales/[year], /api/sample/stress/[rows] |
Sample data for the demo reports. hard takes ?rows= (max 200,000). |
body: JSON.stringify({
template: 'loan-statement', format: 'pdf', parameters: { accountId: 'LN-2025-001982' },
pdf: {
userPassword: 'to open it', // '' or left out: anyone can open it, the permissions still apply
ownerPassword: 'to change the rules', // left out: a random one nobody knows
permissions: { copy: false, modify: false }, // each one allowed unless set to false
},
}),Permissions: print, printHighQuality, modify, copy, annotate, fillForms, accessibility, assemble. The file is AES-256 (the PDF 2.0 standard security handler, revision 6), which Acrobat X and later, pdf.js, poppler and macOS Preview open. Passwords are Unicode (NFKC-normalised) and at most 127 bytes in UTF-8; longer is refused, not cut. A password is never in an error message. A password cannot go with pdfa (PDF/A forbids encryption) or sign: both are refused with 400.
CLI: pw render report.pw.json --password 'to open it' --owner-password 'boss' --deny copy --deny modify -o out.pdf. In code: exportPdf(model, { fonts, encrypt: { userPassword, ownerPassword, permissions } }).
POST /api/v1/batches → 202 with the job. The job runs in the background.
{
template: 'loan-statement',
format: 'pdf',
fileName: 'statement-{Parameters.accountId}', // expression template for each file name
// either a list of items ...
items: [
{ parameters: { accountId: 'LN-2026-004417' } },
{ parameters: { accountId: 'LN-2025-001982' }, data: { /* pushed data */ }, putUrl: 'https://bucket/presigned' },
],
// ... or a URL that gives the list
itemsFrom: { url: '/api/sample/loans', path: '$[*]', map: { accountId: '$.id' }, headers: {} },
output: { type: 'zip' }, // zip (default) | merged (one PDF) | folder ({ type, folder }) | none
webhook: 'https://your-app/hooks/reportwright',
}| Route | What it does |
|---|---|
GET /api/v1/batches |
Last 50 jobs |
GET /api/v1/batches/<id> |
Job status: queued, running, completed, completed_with_errors, failed; done, failed, errors[], results[] |
GET /api/v1/batches/<id>/download |
The zip or merged PDF |
- One failed item does not stop the batch. Its error goes into
errors[]. folderoutput writes the files todata/outputs/<folder>/on the server for service keys; a user's key writes todata/outputs/users/<id>/<folder>/(its own folder), so one user can never overwrite files another batch delivers. Pusheddata(render and batch items) needs a designer or a service key.putUrluploads each file with HTTP PUT (for example to a pre-signed S3 or Azure URL).- A batch can hold at most 10,000 items.
PW_BATCH_CONCURRENCYsets how many render at the same time.
When the job finishes, the server sends POST to webhook with this body:
{ "event": "batch.finished", "job": { "id": "b_…", "status": "completed", "done": 2, "failed": 0 }, "downloadUrl": "https://…/api/v1/batches/b_…/download" }When PW_WEBHOOK_SECRET is set, check the signature before you trust the body:
import crypto from 'node:crypto';
const expected = 'sha256=' + crypto.createHmac('sha256', process.env.PW_WEBHOOK_SECRET).update(rawBody).digest('hex');
const ok = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers['x-reportwright-signature'] || ''));A schedule runs a batch on a cron expression in a time zone.
// POST /api/v1/schedules → 201
{
name: 'Monthly statements',
template: 'loan-statement',
cron: '0 7 1 * *', // minute hour day-of-month month day-of-week (0 or 7 = Sunday)
timezone: 'Asia/Kolkata',
itemsFrom: { url: '/api/sample/loans', path: '$[*]', map: { accountId: '$.id' } },
output: { type: 'folder', folder: 'monthly' },
fileName: '{Parameters.accountId}',
webhook: 'https://your-app/hooks/reportwright',
enabled: true,
}| Route | What it does |
|---|---|
GET /api/v1/schedules |
All schedules, each with nextRunAt |
GET / PUT / DELETE /api/v1/schedules/<id> |
Read, change, remove |
POST /api/v1/schedules/<id>/run |
Run now; gives the batch job |
A batch or schedule may carry email: { to: ['a@example.com'], subject?, body?, attach?: true } (needs PW_SMTP_URL,
PW_MAIL_FROM and PW_MAIL_ALLOWED_DOMAINS), and fromSnapshot: true to reuse a fresh snapshot (see
GOVERNANCE.md). GET /api/v1/batches/<id>/download?exp=…&sig=… is the signed link a scheduled email
carries. Batch output is stored where every server reads it (data/blobs, the database, or PW_BLOBS=s3://…).
Cron supports *, lists 1,15, ranges 1-5 and steps */15. Names such as MON are not supported; use numbers. The scheduler checks every 30 seconds in the server process. Schedules are in data/schedules.json. Set PW_SCHEDULER=off on all servers but one when you run more than one.
| Route | What it does |
|---|---|
GET / POST /api/reports |
List, create |
GET / PUT / DELETE /api/reports/<id> |
Read (the ETag is the report's revision), save (keeps a version), remove. Saving an existing report needs If-Match: "<rev>" (the ETag it was edited from) or If-Match: * to overwrite on purpose: a stale revision is 409 { error, rev } with the current revision, none is 428; nothing is overwritten. A 200 answers the new rev and is in the next read on every server. |
GET /api/reports/<id>/versions |
Saved versions |
POST /api/reports/<id>/versions |
{ version }: restore that version |
GET /api/reports/<id>/pdf?format=…¶m=value |
Render on the server |
GET /api/reports/<id>/thumb |
Page 1 as SVG with default parameters (home page cards); cached per report content and viewer |
GET / PUT /api/reports/<id>/access |
Its folder, inheritance and grants; PUT { folder?, inherit?, grants? } moves or shares it (manage) |
GET / POST /api/folders |
Folders the caller may see (and its level on each), { root: { access }, folders }; POST { name, parent? } adds one (manage on the parent) |
GET / PATCH / DELETE /api/folders/<id> |
A folder with its grants; PATCH { name?, parent?, inherit?, grants? }; DELETE an empty folder. <id> = root: the top-level grants (admins) |
GET /api/audit?from&to&type&actor&report&limit&before[&format=csv] |
The audit log, newest first (admins). type ending in . is a prefix (report.) |
POST /api/reports/import?name=…&folder=… |
Import a report file (at most 5 MB): ActiveReportsJS .rdlx-json as JSON, or an SSRS .rdl / .rdlc sent as application/xml. 201 { id, warnings, stats }; 400 { error } when the file is not a report |
POST /api/reports/assess |
Assess reports before importing (nothing is saved). Multipart files (report, resource and image files, or a .zip of them; at most 500 files, 8 MB each, 256 MB in all), an optional usage file (CSV or JSON, see docs/migration-assessment.md), and the query retireDays, hours=simple=…,medium=…,complex=…. 200 the assessment (the same JSON as pw assess writes); 400 { error } no report files; 413 too large |
POST /api/audit/export |
{ report, format }: the viewer reports an export it made in the browser (logged as client: true) |
These routes use the app's sign-in (PW_AUTH=users, the shared PW_BASIC_AUTH, or PW_AUTH=proxy with PW_PROXY_SECRET behind a reverse proxy that signs people in), not API keys. In production with none of them they answer 401 with how to set one up, or, with PW_PUBLIC_READONLY=1, allow only what a viewer does (read and render saved reports, run their saved queries). Every write must come from a ReportWright page in every mode: an Origin (or Referer) naming this server, else 403.
Server-side fetches: relative data URLs resolve against PW_BASE_URL (required in production; the server never takes its own address from a request header). A data source may only GET from this server, and only this server receives its credentials. With a user's key, batches and schedules reach public hosts only (itemsFrom, putUrl, webhook; baseUrl is ignored) unless the user is a designer. In production a data source's host must be written out: parameters and expressions may fill only the path and query (PW_FIXED_FETCH_HOSTS, 403 otherwise). Redirects from public hosts cannot reach this server or PW_INTERNAL_HOSTS.
Saving, creating, importing or restoring a report whose data sources include SQL, or a fetch that may reach a host in PW_INTERNAL_HOSTS, needs a designer (or admin) in every mode; others get 403. The server records a fingerprint of those sources with each such save. When a report runs on the server (/api/data/sql with { report, source }, /pdf, /thumb, /api/v1/render, batches, schedules, subreports), its SQL and internal fetches run only if their fingerprint was recorded: a definition changed outside ReportWright answers 403 (… no designer saved on this server. A designer must open it and save it again.) until a designer saves it.
| Route | Who may call it with accounts off |
|---|---|
POST /api/data/sql { connection, query } (unsaved SQL) |
Development, PW_BASIC_AUTH, PW_AUTH=proxy. Never in production with no sign-in. With accounts on: designers and admins. |
POST /api/data/sql/test, GET /api/data/sql/connections, POST /api/fonts, DELETE /api/fonts/<id>, POST /api/ai/report |
The same (designers with accounts on). |
With accounts on, each report has a level for each user: view (open, run, export, run its saved SQL), edit (also save, restore, version history) or manage (also share, move, delete). A grant is { "to": "user:ann@acme.com" | "group:finance", "level": "view" | "edit" | "manage" }. A report gets the highest grant on itself, then on its folder and the folders above while inherit is true, then the top-level grants. Defaults on a new install: the top grants group:designers view, so designers see every report and viewers only what a grant gives them; the creator of a report or folder manages it; designers may add reports and folders at the top (the root record's create, default ["group:designers"]; PATCH /api/folders/root { create: [] } leaves it to edit grants). An install from before these defaults (reports stored, no top-level record) gets group:everyone view at the top once, so nobody loses sight of a report; managing an older report then takes its creator's grant or an admin. The role is a ceiling: viewers view at most, admins manage everything. group:everyone is every signed-in user; group:designers every designer and admin; group:public also anonymous viewers embedded from PW_EMBED_ORIGINS. The three are built in: no user group may take their names. A report a user may not view is not found (404) on every route, the viewer, the designer, thumbnails, exports, /api/v1, saved SQL, and as a subreport. A new report's creator manages it. Old versions (id@version) need edit.
POST /api/reports/import with content-type: application/xml (the home page's Import file does this for .rdl and .rdlc) converts a Microsoft SQL Server Reporting Services or Report Builder report, RDL 2008, 2010 or 2016, into a ReportWright report. In code: importRdl(xmlText, { name }) from src/importers/rdl.js returns { definition, warnings, stats, error? } and never throws. RDLX-JSON (ActiveReportsJS) is RDL written as JSON, so the SSRS importer rewrites the XML into that shape and reuses the ActiveReports mapping and expression translator.
The file is untrusted. The XML reader (src/importers/xml.js) refuses <!DOCTYPE and <!ENTITY (no XXE, no entity expansion), knows only the five XML entities and character references, caps the size (16 M characters; the route allows 5 MB), nesting (128), elements (250,000) and attributes per element (64), and runs in linear time. Expressions longer than 20,000 characters are left out; the expression translator and every pattern applied to the file are linear. Custom code (<Code>) is never run. The output is budgeted too, so a small file cannot become a huge report: Variables! and ReportItems! expansions are worked out once and capped (20,000 characters each, 16 M in all), tables are capped at 250,000 cells each and 1,000,000 in all (checked before cells are converted), data regions nest at most 8 deep, embedded images are stored once (images, referenced as embedded:name), and the finished definition is capped at 16 M characters. Going over a total refuses the import with 400 { error }.
stats counts report items: mapped (behaves the same), approximated (in the report, something changed: a warning says what), dropped (left out: a warning says why). Each warning starts with the item's name.
| SSRS | In ReportWright |
|---|---|
| Data sources and data sets | SQL Server (and other SQL providers): a sql source; the connection string is not imported, set PW_DB_<NAME> on the server. A shared data source (DataSourceReference) is treated as SQL Server, with a note. "Enter Data" data sets become rows embedded in the report. Query parameters bind to the report parameter they name (@Region = Parameters!Region.Value). Fields keep their type (rd:TypeName); calculated fields and data set filters are mapped. Shared data sets, XML, SharePoint and cube (MDX) sources: no rows, with a note. |
| Report parameters | Types, prompts, defaults (literal; from an "Enter Data" data set), valid values (a list, or a data set: cascading parameters re-query it), multi-value, nullable / allow blank, hidden. A default from a SQL data set: a note. |
| Page, header, footer | Page size and margins, page header and footer (with backgrounds, first/last page), several report sections. A body wider than its page widens the page (SSRS prints the overflow on extra pages). |
| Text boxes | One text run: a text box with its style. Several runs with the same style: one value ("Page " & Globals!PageNumber & … becomes a template). Runs formatted differently: rich text (bold, italic, colours, sizes, fonts, underline, bullets and numbering; expression runs become fields). In a table cell, runs keep the first run's style (a note). |
| Tablix | No column groups: a table (row groups with headers and footers, nested groups, several detail rows per record, static rows, spans, sorting, filters, drill-down from Visibility/ToggleItem, RepeatOnNewPage, KeepTogether, page breaks, document map labels, user sort). Column groups: a matrix (row and column groups, totals). One cell holding a rectangle: a list. One column of rectangles (letters, invoices): a banded list. Images, charts, sub-tables and indicators in cells are laid out inside the cell. |
| Charts | Column, bar, line (smooth, stepped), area, pie, doughnut, funnel, pyramid, scatter, bubble, range, stock and candlestick, polar, radar; stacked and 100 % stacked; combinations of series types and a secondary axis; category and series groups; titles, legend, axis titles, formats, min/max, log scale, gridlines, label angle; data labels (#PERCENT, #VALY… keywords); palettes and custom palettes; drill-through on points. Data bars and sparklines (Report Builder's charts in cells) become ReportWright's data bar and sparkline. |
| Gauges | Approximated: a radial or linear gauge becomes a half-circle gauge with the first pointer's value and the scale's minimum and maximum (ranges, ticks and frame are left out). A state indicator becomes an icon set (arrows, flags, symbols, ratings, traffic lights) with its state thresholds. |
| Other items | Line, rectangle (container), image (embedded, external URL, database field as base64), subreport (and its parameters; import the target report too, it is found by its file name). Maps: a map item. Embedded shapes (the map gallery's, SQL Server geography in VectorData) become GeoJSON; the first polygon layer's colour range rule gives the value, the start and end colours, classes (bucket count) and the legend format; its binding field pair joins the data set to the shapes; embedded line layers are added (line colour, width); a drill-through on the polygons becomes the region click. Shapefile layers (MapShapefile): SSRS references the .shp by path only, so the importer reads it when the caller has it: pw import <folder> finds the .shp by that path or its file name in the imported folder, with the .dbf of the same name beside it (its attributes join the data); polygons (holes kept), polylines, with or without Z/M; point records are noted. The reader (src/engine/geo.js) checks the header (file code 9994, version 1000), each record's length and counts against the bytes left, and that parts rise (no point emitted twice); the running caps over every map (20,000 shapes, 200,000 coordinates emitted), 16 MB per file, 128 dBASE fields and 2 M attribute characters apply, and a hit is noted. A projected shapefile (not longitude/latitude) or one not in the import keeps the map with its data bindings and colours, empty shapes, and a note. SQL spatial layers (MapSpatialDataSet) keep their data set as the shapes' data set and the spatial field as geometry; at render time the map decodes the field (src/engine/geo.js): the geography binary as the driver returns it (bytes, a JSON {type:'Buffer'}, 0x… hex or base64), WKT (POINT, LINESTRING, POLYGON, MULTILINESTRING, MULTIPOLYGON, optional SRID=n;, Z/M dropped) or GeoJSON. Write the query to return Geo.STAsText() or the column itself. Decoding is bounded like the import: emitted coordinates count against the map's 200,000 cap (the shape that passes it and those after are not drawn, with a warning), WKT nests at most 3 deep and is at most 4 MB, and an unreadable value is named in a warning. Point layers keep their data set (set latitude and longitude, noted); tile layers, middle colours and size/marker rules are noted. Not supported: custom report items, RDL 2005 Table/Matrix/List (upgrade the file in Report Builder first). |
| Actions | Hyperlinks, drill-through (to the imported report with that file name, with parameters), bookmark links, bookmarks and document map labels. |
| Expressions | Fields!x.Value, Parameters!p.Value (.Label gives the value, with a note), Globals!PageNumber / TotalPages / ExecutionTime / ReportName, aggregates with a scope (Sum(x, "Group"), RunningValue, RowNumber, CountRows, StDev, Previous, Lookup), IIf / Switch / Choose, Format / FormatNumber / FormatCurrency / FormatPercent / FormatDateTime, string, date and math functions (Math., Convert., Microsoft.VisualBasic. prefixes), &, Mod, And, Or, Not, Is Nothing, Like. Variables!x and Me.Value are replaced by their expressions; ReportItems!x too when that text box is outside a data region or in the same one. What cannot be translated (custom Code. calls, InScope, User!, ReportItems! of another region, unknown functions) stays visible as text, and a warning names it. |
| Custom code | Simple functions become report functions (functions): a Function with plain (ByVal) parameters whose body is one Return expression (or Name = expression) the expression translator handles (IIf, Format, FormatNumber/FormatCurrency/FormatPercent, Left/Right/Mid/Len/UCase/LCase/Trim, CStr/CInt/CDbl, arithmetic, comparisons…); Code.Name(…) calls to them are kept. Anything else (loops, Dim, several statements, Subs, Optional parameters, calls to other code functions) stays in customCode as text, never run, and is noted by name. Bounded: 100,000 characters of code (longer code is not converted, noted), 200 functions, 20,000 characters per expression. |
Tested on 32 Microsoft sample reports (tests/fixtures/rdl/corpus, MIT): all import, validate and render; 762 report items, none dropped.
POST /api/reports/import with content-type: application/xml (the home page's Import file does this for .jrxml) converts a JasperReports design, JasperReports 3 to 6 (<textField><reportElement …/>) or the 7.x format (<element kind="…">). XML imports are told apart by their root element (src/importers/index.js, importXmlReport). In code: importJrxml(xmlText, { name }) from src/importers/jrxml.js, { definition, warnings, stats, error? }, never throws. Like the SSRS importer it rewrites the design into the RDLX-JSON shape and reuses the ActiveReports mapping, notes and stats; the file is untrusted in the same way (the safe XML reader; the only DOCTYPE dropped is a bare reference to the JasperReports DTD, one with an internal subset is refused; expressions capped at 20,000 characters; variables inlined at most 16 deep; the output budget).
| JasperReports | In ReportWright |
|---|---|
| Bands | Title, then the page header and column header on page 1 (later pages: the page header band, column header included); the detail and the groups as a banded list (group header and footer bands, several bands per section stacked, a band's printWhenExpression kept); summary; column footer above the page footer. Several detail columns (columnCount): body columns. Background, no-data and last-page-footer bands: a note. Book reports (sectionType="Part"): each part a subreport on its own pages. |
| Elements | Text fields (pattern → format, stretch → can grow, hyperlinks, anchors, tooltips), static text, images (a field: database image; a path: needs a URL), lines, rectangles (rounded), ellipses, frames, subreports (and their parameters; import the target too), page breaks. Lists (jr:list) become lists, barcodes (Barbecue, Barcode4J) barcodes. Charts become ReportWright charts: pie, bar/column (horizontal, stacked), line, area, XY and time series, scatter, bubble, meter and thermometer (gauge), candlestick, high-low, Gantt; 3D charts are drawn flat. Crosstabs become matrices: row and column groups (bucket expressions, ascending/descending), measures (Sum, Count, DistinctCount, Average, Lowest, Highest, First…) as values, totalPosition Start/End as group totals with their header text, the header cell as the corner, header, cell and total styles and patterns; several measures in a cell become several values. Shapes and extra elements in crosstab cells, percentage measures and crosstab parameters are noted. Not converted (noted): table components, generic elements, multi-axis charts. |
| Styles | Named styles with parents, the default style, conditional styles (colours, bold, italic as IIF), boxes (pens per side, padding), fonts, alignment. Markup (markup="html", "styled", "rtf", isStyledText) becomes a rich text item: b, i, u, sup, sub, br, li, <font face size color>, <style isBold isItalic isUnderline isStrikeThrough forecolor backcolor size fontName>, and RTF \b \i \ul \strike \super \sub \par \line \'hh \uN; other tags are dropped with their text kept (noted). Bounded: 100,000 characters in, 200,000 out, 32 levels, 20,000 tags (a cut is noted). A text field whose HTML comes from an expression is a rich text item with htmlFromData (noted); styled or RTF markup built by an expression shows as plain text (noted). rotation="Left", "Right", "UpsideDown" → rotate 270, 90, 180 (rotated rich text is drawn upright, noted). |
| Data | The main query: SQL with $P{x} → @x (a sql source; set PW_DB_<NAME>); $P!{…} and $X{…} are noted. No query (a Java data source) or xPath/JSON/CSV queries: a JSON source to point at the data. Sub-datasets become data sets; fields keep their type; filterExpression and sortField map. Parameters keep their type, description, isForPrompting, literal and expression defaults; parameters holding Java objects (images, connections, maps) are left out. |
| Variables | Inlined where used as aggregates with their reset scope: calculation="Sum" with resetType="Group" is Sum(…, "Group"); report totals use the whole data set; in the detail band the running value Jasper prints there (a report-wide running total restarts per group, noted). Count, DistinctCount, Average, Lowest, Highest, StandardDeviation, Variance, First. PAGE_NUMBER (and with evaluationTime="Report" the page count), REPORT_COUNT, <group>_COUNT. Page and column totals add up over their band's rows (noted); PAGE_COUNT, COLUMN_* and scriptlet-set (System) variables show as text. |
| Expressions | Java and Groovy (src/importers/java.js): $F{}, $P{}, $V{}, + as concatenation when a side is a String (by field class), arithmetic, %, comparisons, ==/!= with null, &&, ` |
Tested on 49 JasperReports demo samples (tests/fixtures/jrxml/corpus, LGPL-3.0; 39 in the 6.x format, 10 in the 7.x format): all import, validate and render; 1,492 elements: 1,368 mapped, 121 approximated, 3 dropped (99.8% kept). Most frequent notes: fonts not bundled (49), SQL connection to set (28), rows from Java code (25), style templates not in the file (25), two-column detail (14), column header in the page header (14), page/column totals (24), PAGE_COUNT/COLUMN_COUNT (24).
.rptdesign files go through the same route (the home page's Import file). In code: importBirt(xmlText, { name }) from src/importers/birt.js. Same front-end design and the same untrusted-file rules (no DTDs, caps, bound columns resolved at most 12 deep, the output budget).
| BIRT | In ReportWright |
|---|---|
| Layout | BIRT flows items top to bottom: they are stacked with their height, or one estimated from the text. Master page: size (us-letter, a4, a5, a3, us-legal, custom), orientation, margins, page header and footer. Several master pages: the first. |
| Items | Tables (column widths, header, groups with header and footer rows, detail, footer, spans, the table-header/table-detail… selectors, highlight rules as IIF colours, sorts, filters, group sort and page breaks), grids (each cell's items at its column and row), lists (banded list with groups), labels, data (bound columns, number and date formats), text (HTML reduced to text, <value-of> as expressions), dynamic text, auto text (page number, total pages), images (embedded, URL, data), drill-through, hyperlinks, bookmarks, visibility. Crosstabs become matrices: the cube's levels are row and column groups (a date level is its year, quarter, month or day), measures (sum, count, average, min, max…) values, grand totals and subtotals (aggregationHeader) group totals with their labels, the header cell the corner, cell styles and number formats; other items in cells and computed measures are noted. Charts become ReportWright charts: bar (column, or bar when transposed), line, area, pie, scatter, bubble, stock (candlestick), radar, meter (gauge); tube, cone and pyramid as columns; the base axis series is the category, each value series its value aggregated as its grouping says (Sum by default; a 'category grouping off' chart is noted), a series query groups the series, mixed series types keep their type, stacked subtypes stack, the title, legend (shown or not) and axis titles carry over. Other chart types (Gantt, difference…) are left out with a note. Bounded: 500 charts per report, 32 series per chart (noted). Event scripts (onCreate, onRender) that only set a style become style expressions: this.getStyle().p = "v"; and if (cond) this.getStyle().p = "v"; [else this.getStyle().p = "w";] (braces allowed) for colour, background, font weight, style, size and alignment, with a condition the expression translator handles (2,000 characters per script; strings, nesting and statements read in one pass). Not converted (noted): items from libraries, other event scripts. |
| Data | JDBC data sources: sql sources (set PW_DB_<NAME>); flat-file, XML and scripted sources: a JSON source to point at the data. Data sets: the result set (typed fields), computed columns, filters, the query with each ? bound to the report parameter its data set parameter links to. Joint and scripted data sets: a note. |
| Parameters | Types, prompt text, defaults, required/null/blank, hidden, multi-value, static choices, choices from a data set (row["X"] value and label). |
| Expressions | BIRT's JavaScript: row["X"] (bound columns, resolved; their aggregates SUM, COUNT, COUNTDISTINCT, AVE, MIN, MAX, FIRST, LAST, RUNNINGSUM with aggregateOn as the group scope), dataSetRow["X"], params["P"].value, row.__rownum, Total.sum(…) and friends, BirtStr, BirtMath, BirtDateTime, BirtComp, Formatter.format, string methods, and the Java forms above. Statements (;, var), reportContext, vars, filtered aggregates and ranks show as text with a note. |
Tested on 29 BIRT sample reports (tests/fixtures/birt/corpus, EPL-2.0): all import, validate and render; 649 items: 615 mapped, 31 approximated, 3 dropped (99.5% kept). Most frequent notes: SQL connection to set (22), fonts not bundled (12), HTML values shown as text (10), event scripts (7), table rows with more than text (7).
POST /api/reports/compare (multipart/form-data, the files original and converted, at most 5 MB each, the import limit): the
pw compare result (see migration-compare.md) as JSON with the self-contained page as html;
?format=html returns the page alone (served with a CSP that allows nothing but inline styles and data: images).
Query: tolerance (pt, 2), threshold (%, 0), dpi (72–100), numbersOnly=1. Same access as import: designers,
admins and service keys (401 not signed in, 403 viewers); 413 too large, 422 a PDF the reader refuses (malformed, over
budget, timed out), 429 when the server is busy (the render admission) or two comparisons are already running. Audited as report.compare.
curl -F original=@sales-ssrs.pdf -F converted=@sales-rw.pdf -H "Authorization: Bearer $KEY" \
"https://reports.example.com/api/reports/compare?format=html" > compare.htmlLayers become report layers (TargetDevice Screen/Paper/Export/None → screen/print/export/design, Visible: false → hidden) and each item's LayerName its layer. A library's ReportParts become parts (ReportItemName → item, Properties → properties with their defaults); reportpart items become part items (Library → the report id that file gets when imported, ReportPart, Properties as values); PartProperties!x.Value reads them. MasterReport becomes master (the report id of that file); ContentPlaceHolder items in a master become placeholders. The notes say which id to import each library and master under.
| Setting | |
|---|---|
PW_OIDC_ISSUER, PW_OIDC_CLIENT_ID, PW_OIDC_CLIENT_SECRET |
OpenID Connect (authorization code + PKCE). Register https://<PW_BASE_URL>/api/auth/oidc/callback as the redirect URI. PW_OIDC_SCOPES (default openid email profile), PW_OIDC_GROUPS_CLAIM (default groups), PW_OIDC_NAME (button label). The ID token must carry email_verified: true |
PW_SAML_ENTRY_POINT, PW_SAML_IDP_CERT (PEM or base64, or PW_SAML_IDP_CERT_FILE), PW_SAML_IDP_ISSUER (all three required) |
SAML 2.0 (HTTP-Redirect request, HTTP-POST response, signed assertions required). SP metadata: /api/auth/saml/metadata; ACS: /api/auth/saml/acs. PW_SAML_ISSUER (SP entity id), PW_SAML_EMAIL_ATTR, PW_SAML_GROUPS_ATTR (default groups), PW_SAML_NAME |
PW_SSO_ROLE_MAP |
idp-admins=admin,idp-designers=designer: an IdP group or role value → ReportWright role (the highest wins) |
PW_SSO_DEFAULT_ROLE |
Role without a mapped value: viewer (default), designer, admin, or none to refuse the sign-in |
PW_PASSWORD_LOGIN=off |
No password sign-in while SSO is set up |
PW_SSO_ALLOWED_DOMAINS |
acme.com,acme.co.uk: only these email domains may sign in with SSO |
PW_BASE_URL |
Set it: the redirect URI, ACS and audience come from it |
An account made by single sign-on is bound to the IdP identity (OIDC issuer and sub; SAML issuer and NameID), not to the email: the same identity is the same account even if its email changes, and another identity with the same email is refused. SSO never takes over an existing password account by itself: an admin first presses Allow SSO on the user (PATCH /api/users/<email> { allowSso: true }), and the next single sign-on with that email binds it (the password stays). Emails must be ASCII. Accounts are made on first sign-in and their role and groups follow the IdP at every sign-in. Every valid group name the IdP sends becomes a group for permissions.
Details and settings: GOVERNANCE.md.
| Route | What it does |
|---|---|
POST /api/auth/login |
{ email, password } → a session, or { mfa: 'totp' | 'enrol' } and the pw_mfa cookie |
POST /api/auth/mfa |
{ code } or { recoveryCode }: the second step (enrolling: the answer has recoveryCodes) |
POST /api/auth/mfa/setup |
while enrolling at sign-in: { secret, uri, qr } |
GET /api/account, POST /api/account/2fa |
one's own account; { action: 'setup' | 'enable' | 'recovery' | 'disable', code? } |
POST /api/auth/reset/request, POST /api/auth/reset/confirm |
{ email } (always 202); { token, password } |
POST /api/auth/logout |
{ ok, redirect? }: after an SSO session, the IdP's logout address |
GET|POST /api/auth/saml/slo |
SAML single logout (signed messages only) |
GET|PATCH /api/admin/settings |
{ require2fa, snapshotTtl, snapshotMaxMb } and what the environment sets up (admins) |
GET|DELETE /api/admin/snapshots |
snapshot cache size; clear it (admins) |
GET /api/audit/verify?from&to, POST /api/audit/checkpoint |
{ status: 'ok' | 'unverified' | 'tampered' | 'error', … }; only ok passes (admins) |
GET|POST /api/schedules, PATCH|DELETE /api/schedules/<id>, POST /api/schedules/<id>/run |
the Schedules page (designers, own schedules) |
- Audit hash chain (beta). It shows changed, removed or inserted events, removed streams, a cut tail before the
newest signed checkpoint, and unsigned or foreign-signed records. It cannot show: the newest events (after the last
signed checkpoint, up to two checkpoint intervals) removed together with everything after them; a made-up stream
younger than two intervals (counted as pending, never as proven); anything done by someone holding both write access
to the storage and the signing key (keep
PW_AUDIT_SIGNING_KEYon the server only, verify with the public key kept elsewhere, and ship to a SIEM for a copy out of reach). A key derived fromPW_SESSION_SECRETis held by every server. An automated review reported an "audit-integrity" finding that was not resolved in detail; treat the chain as beta. - Admin changes (users, access, settings) are stored before their audit event; if that event cannot be written the request answers 503, but the change stays.
- The SIEM queue is in memory: events waiting when a process stops are not shipped (they are in the log).
- Password sign-in, two-factor codes and reset requests are limited across servers (storage leases). The client address is the socket's;
X-Forwarded-Forcounts only fromPW_TRUSTED_PROXIES. Failures for an account never lock it (see README, Sign-in limit);PATCH /api/users/<email> { unlockSignIn: true }(admin) clears its counts. - Uploaded fonts do not start a new snapshot generation: clear the snapshot cache after changing fonts.
The viewer is one component: the /viewer/<id> page, the designer's Preview tab, mountViewer() on other sites and the interactive HTML export all use it.
<script src="https://reports.example.com/embed/reportwright-viewer.js"></script>
<script>
ReportWright.mountViewer('#report', {
server: 'https://reports.example.com',
report: 'loan-statement',
params: { accountId: 'LN-2025-001982' },
lang: 'hi', // UI language, see below
viewMode: 'continuous', // 'single' | 'continuous' | 'galley'
toolbar: {
hide: ['excel', 'word'],
add: [{ id: 'email', label: 'Email', title: 'Email this statement', after: 'print', onClick: (api) => sendMail(api.page) }],
},
});
</script>In React: <ReportViewer definition={def} reportId="loan-statement" lang="hi" viewMode="single" toolbar={{ hide: ['csv'] }} /> (src/viewer/ReportViewer.jsx).
Every built-in item has a stable id. toolbar.hide removes items by id; toolbar.add adds buttons { id, label, title?, after?, onClick? }. A new button goes right after the item named by after (in the same group), or at the end of the toolbar. An add id that is a built-in id is ignored: hide the built-in and add your own to replace it.
| Group | Ids |
|---|---|
| panels | parameters, documentMap, run |
| paging | firstPage, previousPage, pageNumber, nextPage, lastPage |
| zoom | zoomOut, zoomValue, zoomIn, fitWidth |
| view | viewMode, fullScreen |
| info | stats |
| search | search (box, match case, whole word, previous/next, list of matches) |
| export | print, pdf, excel, word, powerpoint, html, csv, json, exportOptions |
parameters and documentMap show only when the report has parameters or bookmarks; fullScreen only where the browser allows it. In the page each item is wrapped in an element with data-toolbar-id="<id>".
onClick gets api: { page, pages, goTo(n), run(), print(), exportAs('pdf' | 'xlsx' | 'docx' | 'pptx' | 'html' | 'csv' | 'json') }. Built-in export ids: pdf, excel, word, powerpoint, html, csv, json, exportOptions (the ⚙ menu: accessible PDF, PDF/A, Excel formulas, kind of HTML file; kept in the browser). json is the laid-out pages, the same as the API's json format.
Narrower than 640 px (the viewer's own width, so an embed in a sidebar counts), the toolbar keeps parameters, previousPage, pageNumber, nextPage and search and puts the rest in a "More" menu (custom items too). Side panels open as bottom sheets, and a swipe left or right turns the page.
single: one page at a time.continuous(default): every page in one scroll.galley: the report laid out as one long page as wide as its paper (the engine's pageless layout); page breaks do not apply.- In continuous and galley view, the header row of a table whose header repeats on each page (
repeatHeader, the default) stays at the top while that table scrolls. - Print makes the same PDF as the PDF button and prints it from a hidden frame; where the browser blocks that, the PDF opens in a new tab. Print and the exports are always of the paged report, also in galley view.
- Full screen uses the browser's Fullscreen API on the viewer element.
Search ignores case unless Match case (Aa) is on; Whole word (ab) matches only whole words, in any script (Devanagari vowel signs count as part of a word). The list button shows every match with its page number; click one to go there. A justified line is matched as one line, not word by word.
A parameter's editor picks its control in the parameter panel. Without it, the control follows the type and the choices, as before.
editor |
For | Options | Value |
|---|---|---|---|
slider |
number | min (0), max (100), step (1) |
the number |
range |
number, multi: true |
min, max, step |
two numbers, Parameters.x[0] and Parameters.x[1] |
dateRange |
date, multi: true |
min, max (yyyy-mm-dd) |
two dates, Parameters.x[0] and Parameters.x[1] |
radio |
any, with choices | the picked value | |
list |
any, with choices | multi for more than one |
the picked value(s) |
toggle |
boolean | true / false |
A range with one bound filled takes the other from min/max. Filter with both bounds, for example { "expr": "=Fields.amount", "op": ">=", "value": "=Coalesce(Parameters.amount[0], 0)" }. reports/parameter-editors.pw.json uses every editor.
"parameterLayout": { "columns": 3 } on the report puts the parameter panel above the pages as a grid of 3 columns (on a phone it is still one column, in a sheet). The designer's parameter dialog sets both.
?lang= on any page (/, /viewer/<id>, /designer/<id>, /admin/users, /login) or the lang option: en, hi, es, fr, de, ja, zh, pt-BR, ar. Arabic turns the interface right-to-left; report pages are never mirrored. Links from the home page keep the language. Strings live in src/i18n/<lang>.js; a unit test checks that every language has every key. The translations other than English are machine quality and need a native speaker's review. The designer's property inspector, data dialogs and wizards are still English.
The designer embeds like the viewer. It loads only on pages that ask for it (the viewer's script stays the same size), and it renders in a shadow root so the host page's styles do not leak in.
<script src="https://reports.example.com/embed/reportwright-viewer.js"></script>
<script>
const designer = await ReportWright.mountDesigner('#designer', {
server: 'https://reports.example.com',
definition, // or report: 'id' to load it from the server
onSave: (def) => saveToMyApp(def), // without onSave, Save writes to the ReportWright server (PUT /api/reports/<report>)
onOpen: () => pickAReport(), // adds an Open… button; return a definition (or a promise of one)
readOnly: false, // true: no Save, no toolbox, nothing can be changed
toolbox: { hide: ['map', 'chart'] }, // tool ids: textbox, richtext, table, image, line, shape, list, container, chart,
// matrix, barcode, sparkline, databar, bullet, subreport, toc, field, map, checkbox
panels: { data: true, inspector: true }, // false hides the data panel or the property inspector
dataSourceTemplates: [{ label: 'Orders API', source: { name: 'orders', type: 'rest', url: 'https://api.example.com/orders' } }],
height: '760px',
});
designer.getDefinition(); // the definition as it is now
designer.save();
</script>Keyboard shortcuts work only for keys typed in the designer, never in the host page; typing in the designer's own inputs is never a shortcut (Backspace in a field does not delete the selected item). One designer per page. As an ES module: import { mountDesigner } from '@reportwright/viewer/designer'.
| Package | Use |
|---|---|
@reportwright/viewer |
mountViewer, and mountDesigner from @reportwright/viewer/designer |
@reportwright/react |
<ReportWrightViewer server report params style />, <ReportWrightDesigner server definition onSave /> |
@reportwright/vue |
<ReportWrightViewer :options="{ server, report }" />, <ReportWrightDesigner :options="…" @ready="…" /> |
@reportwright/svelte |
<div use:reportWrightViewer={{ server, report }}>, use:reportWrightDesigner (actions: no compiler step) |
@reportwright/angular |
defineReportWrightElements(), then <reportwright-viewer [options]="…"> and <reportwright-designer (pw-save)="…"> with CUSTOM_ELEMENTS_SCHEMA |
@reportwright/engine |
render, the exporters, defaultFontStore() |
@reportwright/fonts |
the fonts, shaper and subsetter the engine loads (install next to it) |
@reportwright/cli |
the pw command line |
The wrappers are thin: the framework and @reportwright/viewer are peer dependencies, nothing is bundled, and the viewer loads on mount, so server rendering (Next.js, Nuxt, SvelteKit, Angular SSR) never touches window. A viewer remounts when what it shows changes; a designer only for another report or a new definition object, so it keeps its edits. In React, a style.height on the component makes the viewer fill it.
Types: every package ships .d.ts. The engine's API and the viewer's options are generated from their JSDoc; the report definition has hand-written types:
import type { Report, Item } from '@reportwright/engine';
const report: Report = { $schema: 'reportwright/report@1', sections: { body: { items: [{ type: 'textbox', x: 0, y: 0, w: 200, h: 20, value: '=Fields.name' }] } } };Build them with npm run build:packages; tests/fixtures/types/consumer.ts is type-checked by the unit tests.
A text box with headingLevel (1–6) is a heading. A table of contents with "source": "headings" lists the headings (the PDF's bookmarks panel keeps the bookmarks only); without it, it lists bookmarks as before. numbering numbers the lines: "decimal" (1, 1.1, 1.2), "roman" (I, II), "alpha" (A, B), or one per level, ["roman", "alpha"] or "roman,alpha" (the last repeats for deeper levels). A level that is skipped counts as 1. In the viewer, clicking a line goes to its heading.
49 symbologies in the designer with their usual names (Code 128, GS1-128, EAN-13, UPC-A, ITF-14, Codabar, Intelligent Mail, QR Code, Data Matrix, PDF417, Aztec, MaxiCode, …); any other bwip-js id still works in the JSON. Options:
| Key | For | Values |
|---|---|---|
captionPosition |
linear codes | below (default), above; showText: false hides it |
quietZone |
all | points of white inside the box, on every side |
rotate |
all | 0, 90, 180, 270 |
qrErrorLevel, qrVersion, qrMask |
QR codes | L/M/Q/H, 1–40, 1–8 |
dmShape, dmSize |
Data Matrix | square/rectangle, "24x24" |
pdfColumns, pdfRows, pdfErrorLevel, pdfCompact |
PDF417 | 1–30, 3–90, 0–8, true |
aztecLayers, aztecErrorPercent |
Aztec | 1–32, 5–95 |
maxiMode |
MaxiCode | 2–6 |
checkDigit, barRatio |
Code 39, Code 93, Interleaved 2 of 5, Codabar, Code 11, MSI | true, 2–3 |
Every option is checked against its list or range before it reaches bwip-js; anything else is ignored. A value longer than the symbology can hold is refused at once with an error on the page (QR: 7,089 characters; most linear codes: 128).
An image's src can be a URL, a data URI, embedded:<name> for an image the report carries in "images": { "<name>": "data:image/png;base64,…" } (also in backgroundImage), or a data field that holds base64 text (with or without a data: prefix) or bytes (a database BLOB). PNG, JPEG, GIF, WebP and SVG are recognised from their first bytes.
fit: contain (default), cover, fill, or clip (the image at its natural size from the top-left corner, cut to the box). autoSize: true sizes the box to the image. Natural size is 96 dpi (one pixel is 0.75 pt), and is known for data, embedded and base64 images; a URL image's size is not known before it loads, so it is fitted inside the box with a warning.
In the PDF, SVG images are drawn as vector paths: path, rect, circle, ellipse, line, polyline, polygon, groups, transforms, fill, stroke and opacity. Text, gradients, patterns, clip paths, masks, filters and <use> are not drawn there (the viewer and the HTML export show SVG fully). Limits: 10 MB per image and 50 MB of images per report (each distinct image once); larger ones are left out with a warning. In the PDF, an SVG over 2 MB or 10,000 shapes, and a PNG over 40 megapixels or animated, are left out.
A matrix with rowGroups, columnGroups and values arrays is a pivot table (the older rowGroup / columnGroup / value keys still work and render as before). Design: docs/superpowers/specs/2026-10-04-tablix-design.md.
{ "type": "matrix", "name": "Pivot", "dataSet": "Sales", "x": 0, "y": 0, "w": 520, "h": 60,
"rowGroups": [{ "name": "Region", "expr": "=Fields.region", "sort": "asc", "total": "after", "collapsible": true, "width": 80, "header": "Region" },
{ "name": "City", "expr": "=Fields.city", "total": "after" }],
"columnGroups": [{ "name": "Year", "expr": "=Fields.year", "total": "after" }, { "expr": "=Fields.q", "label": "=\"Q\" & Fields.q" }],
"values": [{ "label": "Amount", "value": "=Sum(Fields.amount)", "format": "N0" }, { "label": "Share", "value": "=Sum(Fields.amount)", "show": "percentOfRow" }],
"overflow": "paginate", "pageOrder": "down" }| Key | Meaning |
|---|---|
group expr, label, format, sort, sortBy |
the key; the text shown (default: the key); asc/desc; an expression in the instance's scope to sort by (=Sum(Fields.amount)) |
group total, totalLabel |
before / after: a total of this group's instances inside the group above; on the first group it is the grand total |
group collapsible, initiallyCollapsed |
a ▼/▶ toggle on each instance; a collapsed instance is one row (or column) with the instance's values |
row group width, header |
the header column's width and the title over it |
value show |
value, percentOfTotal, percentOfRow, percentOfColumn (format P1 unless given) |
overflow |
paginate (the default, both forms): columns that do not fit continue on the next pages, the row headers repeated; shrink: the older narrow-then-cut rule; clip: cut at the page edge. Anything cut is listed in the model's clipped warnings, which the viewer opens by itself |
pageOrder |
down (all rows for the first columns, then the next columns) or across (each block of rows on every column set first; starts on a new page) |
A group's name is a scope in value expressions: Sum(Fields.x, "Region") is the region instance across all columns. Limits: 8 levels of groups per axis, 50 values, 1,000 value columns, 250,000 cells (more is cut with a warning). Keys and labels are data: they are never evaluated as expressions.
rowSpanon a cell merges it down over the next rows of the same band (the header rows, one group's rows, one record's detail rows, the footer rows). If its rows break across pages, the text is drawn again at the top of the next page. Word getsvMerge, Excel merged cells.itemon a cell lays out an item (table, list, chart, sparkline…) in the cell. The table's data set means the cell's rows; arelationdata set gets that row's children. One render lays out at most 100,000 rows of items in cells.overflow: "paginate"on a table wider than the page continues the columns on the next pages;repeatColumns: nrepeats the first n columns on each page set;pageOrderas for pivots. Excel and CSV keep every column.printAtBottom: trueputs the table footer at the bottom of the page the table ends on.- A group with
parent(e.g.=Fields.managerId;expris the row's id) is a recursive hierarchy: depth first,Level()is the depth (0 at the top),indentadds points of left padding per level,Sum(Fields.cost, "Group", "Recursive")adds the node and everything under it,collapsiblewithexpandLevels: nopens the first n levels. Cycles are broken and depth stops at 64, with a warning.
columns: non a list puts n records across (a grid list),columnGappoints apart.newSection: trueon a table group or a list: each instance starts on a new page andGlobals.PageNumber/TotalPagescount inside it (one PDF of many invoices, each "Page 1 of 2").Globals.OverallPageNumber/OverallTotalPagescount the whole report.sections.bodycan be an array of body sections,{ name, page, items, height, columns }, each with its own page (pagekeys override the report's). Page numbers continue across sections; the page header and footer are shared. Pages of another size carrywidth/heightin the page model; PDF, HTML, Word and the viewer use them.