Export and charts (milestone M8)
One model for all writers. ExportSheet holds the leaf columns, the header group rows, the rows in display order with a group level, and an optional totals row.
Context
Decision 27 puts export and charts in 1.0. Plan section 8.5 makes IronCalc the first choice for
XLSX, and asks for CSV for all surfaces. Spike S9 asks for a PDF writer without a heavy
dependency: pdf-lib (MIT), loaded on demand. ADR 0006 loads @ironcalc/wasm-xlsx only for
import and export, because only that build has toXlsx and fromXlsx. @ironcalc/wasm 0.9.1
does not have them.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
- One model for all writers.
ExportSheetholds the leaf columns, the header group rows, the rows in display order with a group level, and an optional totals row. Each cell has a value and the text that the grid shows.fromTablemakes the model from a table through a structural type, so@ember-lattice/exportimports nothing from core or Ember. - CSV follows RFC 4180, and is safe by default. The
safeoption puts'before text that starts with=,+,-,@, a tab or a CR (CSV injection). Number cells do not change. - XLSX: the app gives the IronCalc module.
toXlsx(sheet, ironcalc)takes the loaded@ironcalc/wasm-xlsxmodule. The export package does not bundle or load the 2.5 MB engine. Text cells start with'insetUserInput, so IronCalc keeps them as text. - PDF uses the standard fonts.
toPdfloadspdf-libwith a dynamic import. The header rows repeat on each page. A table that is wider than the page shrinks in proportion. - Sparklines are plain SVG. They do not use
@ember-joinery/chart, because a grid can show 1,000 of them. Each hasrole="img"and a label with the minimum, the maximum and the last value. LatticeChartuses@ember-joinery/chart. It reads the current rows of the table, or a range of row ids.
Consequences
Limits
- XLSX: IronCalc 0.9.1 has no row outline API. Group rows are bold, but the file does not keep
the group levels. The writer uses the
enlocale and UTC. - XLSX: the IronCalc column width unit is the pixel. The writer gives the grid width.
- PDF: the standard Helvetica font has WinAnsi letters only. Other letters become
?. A Unicode font needs@pdf-lib/fontkitand an embedded font file. - PDF: a column that is too narrow for one letter and an ellipsis shows no text.
fromTablewithvisibleOnly: falsegives no header group rows.
Confirmation
Evidence
- Vitest,
packages/export/tests: 15 tests. CSV (5, with a fast-check round trip),fromTable(4), XLSX (3, read back withfromXlsx), PDF (3, read back with pdf-lib). - QUnit,
test-app/tests/charts(filterCharts): 9 tests, each with an axe audit. They include a real grouped table with asumaggregation intofromTable, anddownloadin Chrome. - 1,000 line sparklines of 20 points: 72 ms to render and lay out (Chrome 158, Apple M4).
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0014-export-and-charts.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0014-export-and-charts.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-01 | Joe Gaudet | Status in the Markdown file: proposed, 2026-12-01. |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0014-export-and-charts.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.