CSV, XLSX, print and complete exports
Choose an export scope
Section titled “Choose an export scope”| API | Result | Scope |
|---|---|---|
pivot.exportCsv(options) | String | Captured currently loaded logical report |
pivot.exportXlsx(options) | Uint8Array | Same loaded scope, grouped headers and supported native number formats |
pivot.getVisibleExportData(options) | Detached export data | Capture for local writers; not a complete remote fetch |
buildPivotPrintTable(input) | Escaped HTML string | Supplied resolved result; does not open a print dialog |
| `pivot.exportFullReport(‘csv’ | ‘xlsx’, options)` | Result containing content |
A server viewport may contain only a window. Neither local writers nor exporting the loaded model fetch missing server groups. Use complete export for that requirement.
import { buildPivotPrintTable } from '@revolist/pivot/headless';const captured = pivot.getVisibleExportData({ resourceLimits: { maxExportDataCells: 100000 },});const printable = buildPivotPrintTable({ ...captured, resourceLimits: { maxExportUtf8Bytes: 2000000 },});// Place printable in the application's print surface and invoke its print flow.Local captures detach owned headers/records from later grid changes. Captured policy ceilings cannot be raised by writer options; the stricter ceiling wins. Application nested payloads/formatters retain their documented atomic boundaries. Headless helpers exportVisiblePivotToCsv and exportVisiblePivotToXlsx accept supplied columns/body/pinned records; see the executable writer example.
| CSV option | Default | Meaning |
|---|---|---|
columnDelimiter | , | Cell separator |
rowDelimiter | CRLF | Row separator |
bom | false | Prefix UTF-8 BOM |
headerPathDelimiter | / | Flatten grouped captions |
resourceLimits | All omitted/unbounded | Physical output counters |
CSV preserves raw numeric output and escapes delimiters/quotes. XLSX keeps numeric values and supported native Excel measure formats; arbitrary appearance/conditional formatting is not workbook styling. Print HTML contains escaped resolved cells. None of these writers improves binary64 arithmetic precision.
Complete remote export
Section titled “Complete remote export”const abort = new AbortController();try { const result = await pivot.exportFullReport('xlsx', { signal: abort.signal, limits: { maxRows: 5000, maxCells: 100000 }, onProgress: progress => console.log(progress.phase, progress.receivedBytes), }); // Save result.content through the host download flow after success.} catch (error) { console.error(error); // Offer smaller scope or retry; retain the current report.}// Wire a Cancel control to abort.abort().| Complete-export limit | Default/library ceiling | Units |
|---|---|---|
maxRows | 10000 | Body plus total rows |
maxColumns | 256 | Flattened columns including labels and expanded measures |
maxCells | 500000 | Physical rows × columns |
maxBytes | 16000000 | Response JSON and formatted output byte ceiling |
Complete-export limits are positive integers; applications can lower them, not raise the library ceilings. This differs from optional zero-valid local resource counters. Refuse excess output; never silently truncate a complete report.
The backend echoes requestId and queryKey, declares complete: true, scope: 'complete-filtered-report', and an atomic-at-export snapshot ID. It must read domains, counts, facts and totals from one authorized operation-owned snapshot. This is an export-time guarantee, not necessarily the data version of an earlier screen. Dataset-version consistency across requests needs an explicit host contract.
The request retains filters, ranking, sorting, collapse/totals/value orientation and labels while excluding viewport offsets/limits. Other must be reaggregated from original facts. SDK validation rejects incomplete/stale/mismatched output. Authentication, authorization, actual driver snapshots/deadlines/cancellation and server resource release remain backend obligations.
Cancellation settles public export promises and blocks stale downloads even if a custom adapter ignores its signal. It cannot guarantee that such an adapter stopped its database query. Background job infrastructure is deferred. See the complete protocol and remote deployment guide.