@evotecit/officeimo 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -10
- package/bundles/officeimo-canopyx.js +813 -358
- package/bundles/officeimo-canopyx.mjs +700 -246
- package/bundles/officeimo-csv.js +29 -19
- package/bundles/officeimo-csv.mjs +17 -7
- package/bundles/officeimo-datatables.js +806 -360
- package/bundles/officeimo-datatables.mjs +694 -249
- package/bundles/officeimo-execution.js +35 -25
- package/bundles/officeimo-execution.mjs +17 -7
- package/bundles/officeimo-pdf.js +734 -289
- package/bundles/officeimo-pdf.mjs +685 -241
- package/bundles/officeimo-xlsx.js +88 -77
- package/bundles/officeimo-xlsx.mjs +22 -11
- package/bundles/officeimo.js +790 -344
- package/bundles/officeimo.mjs +680 -235
- package/dist/core/index.d.ts +2 -0
- package/dist/core/iteration.js +2 -2
- package/dist/core/sinks.js +2 -1
- package/dist/integrations/canopyx/source.js +13 -7
- package/dist/integrations/datatables/snapshot.js +3 -3
- package/dist/internal/rows.js +13 -4
- package/dist/pdf/document-grouped.js +72 -22
- package/dist/pdf/font-resources.js +2 -1
- package/dist/pdf/inline-text.js +50 -9
- package/dist/pdf/objects.js +188 -11
- package/dist/pdf/pages.js +25 -26
- package/dist/pdf/paragraph-layout.d.ts +2 -0
- package/dist/pdf/paragraph-layout.js +9 -4
- package/dist/pdf/session.js +1 -1
- package/dist/pdf/settings.d.ts +2 -0
- package/dist/pdf/settings.js +27 -2
- package/dist/pdf/structure.js +80 -28
- package/dist/pdf/table-band-flow.js +26 -11
- package/dist/pdf/table-band-plan.js +1 -3
- package/dist/pdf/table-layout.d.ts +4 -0
- package/dist/pdf/table-layout.js +22 -10
- package/dist/pdf/table-structure.js +28 -12
- package/dist/pdf/text.js +5 -0
- package/dist/pdf/types.d.ts +4 -2
- package/dist/pdf/xref.d.ts +1 -0
- package/dist/pdf/xref.js +30 -0
- package/dist/xlsx/values.js +3 -2
- package/dist/zip/entry.js +1 -1
- package/dist/zip/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -269,7 +269,7 @@ Call `preflightPdfText(text, { fonts: { regular }, bold: true })` from `@evoteci
|
|
|
269
269
|
|
|
270
270
|
The default writer handles scalar text layout for Latin, Greek, Cyrillic, Han, Hiragana, Katakana, precomposed Hangul and common symbols, including supplementary Unicode where the font provides it. Keep a supplementary character in one rich-text run when its font, color or link metadata differs from adjacent text; splitting its UTF-16 pair across different presentation fails explicitly. If a supplied TrueType font lacks U+202F (narrow no-break space) but provides an inkless U+2009 (thin space), the writer uses that thin-space glyph and its advance while preserving U+202F in the PDF's Unicode map. Other missing glyphs and malformed surrogates fail explicitly. Combining sequences, bidirectional text and scripts requiring shaping need the optional profile below. It does not provide general HTML/SVG rendering or PDF/A. Composed documents support the bounded image and vector contracts below. Long text is wrapped and continued across pages without truncation; CRLF/CR become line breaks and tabs expand to four spaces for display.
|
|
271
271
|
|
|
272
|
-
`PdfLimits` includes shared row/cell/text/output ceilings plus `maxPages` (default 10,000), `maxColumns` (1,024), `maxCellCharacters` (1,000,000 UTF-16 units), `maxRowLines` (100,000), `maxFontBytes` (16 MiB across unique supplied fonts), `maxPageBytes` (8 MiB of drawing commands and link dictionaries), and `maxHyperlinks` (100,000 native annotations). A continued linked cell creates one annotation per page fragment; repeated linked headings also consume that limit. PDF cell/text budgets count rendered strings, headings, totals and page decorations; `maxRows` counts source rows. Resource failures never silently remove rows, columns or text.
|
|
272
|
+
`PdfLimits` includes shared row/cell/text/output ceilings plus `maxPages` (default 10,000), `maxColumns` (1,024), `maxCellCharacters` (1,000,000 UTF-16 units), `maxRowLines` (100,000), `maxFontBytes` (16 MiB across unique supplied fonts), `maxPageBytes` (8 MiB of drawing commands and link dictionaries), and `maxHyperlinks` (100,000 native annotations). A continued linked cell creates one annotation per page fragment; repeated linked headings also consume that limit. PDF cell/text budgets count rendered strings, headings, totals, bookmark titles and page decorations. Painted tabs count as four spaces; CR/LF separate lines without adding painted characters. The per-cell input ceiling still applies to the captured raw text. Captions count each painted occurrence; an unused continuation caption consumes no cell/text budget. `maxRows` counts source rows. Resource failures never silently remove rows, columns or text. With compression enabled and native deflate available, eligible streams are compressed and completed tagged structure objects share bounded containers. The first container is compressed to establish support; later containers store their bytes directly. This uses fewer native codec instances and produces larger files than compressing every container. Tagged compaction uses PDF 1.5 object/xref streams inside the existing PDF 1.7 document profile; supported readers must understand that representation. `compression: false` or unavailable native deflate retains plain objects and classic cross-references. Ordinary unit cells share immutable attribute objects within their table, retaining the same header identities in compressed and plain output. Object batches are bounded to 256 members and 32 KiB decoded bytes; page/object/font references and caller-owned output remain document-scale state.
|
|
273
273
|
|
|
274
274
|
Workers can call the same writers without a DOM. For a portable worker-to-page handoff, use `writePdfTo` and transfer byte chunks with acknowledgements; this also avoids WebKit worker Blob-read restrictions. Keep the row source and destination bridge bounded, and pass an `AbortSignal` to stop pending input or output. The caller owns disposal of partial bytes after failure, and the library releases borrowed stream locks without closing or aborting the destination.
|
|
275
275
|
|
|
@@ -283,7 +283,7 @@ import { writePdf, saveBlob } from "@evotecit/officeimo";
|
|
|
283
283
|
const rows = [{ service: "WEB-000001", site: "Warsaw", owner: "Operations", environment: "Production",
|
|
284
284
|
availability: 99.98, latency: 4.9, errors: 0, cpu: 21, memory: 48, disk: 35, requests: 12340, checks: 120 }];
|
|
285
285
|
const columns = [
|
|
286
|
-
{ header: "Service", key: "service" }, { header: "Site", key: "site" },
|
|
286
|
+
{ header: "Service", key: "service", rowHeader: true }, { header: "Site", key: "site" },
|
|
287
287
|
{ header: "Owner", key: "owner" }, { header: "Environment", key: "environment" },
|
|
288
288
|
{ header: "Availability %", key: "availability", type: "number" },
|
|
289
289
|
{ header: "Latency ms", key: "latency", type: "number" },
|
|
@@ -293,17 +293,18 @@ const columns = [
|
|
|
293
293
|
];
|
|
294
294
|
const report = await writePdf(rows, {
|
|
295
295
|
columns,
|
|
296
|
-
|
|
296
|
+
tagged: { language: "en-US" },
|
|
297
|
+
wideTable: { mode: "bands", minimumColumnWidth: 90, repeatColumns: ["service", "site"] },
|
|
297
298
|
limits: { maxRows: 100_000, maxPages: 10_000, maxTableBands: 16, maxTableWindowRows: 128 }
|
|
298
299
|
});
|
|
299
300
|
saveBlob(report, "service-inventory.pdf");
|
|
300
301
|
```
|
|
301
302
|
|
|
302
|
-
`minimumColumnWidth` defaults to 72 points for inferred widths. Explicit `columnWidths` remain exact point widths. `repeatColumns`
|
|
303
|
+
`minimumColumnWidth` defaults to 72 points for inferred widths. Explicit `columnWidths` remain exact point widths. `repeatColumns` accepts exact stable column keys or zero-based positions in this table's captured selection. Numeric-only lists must be sorted and unique; string `"0"` is a key, while numeric `0` is a position. Mixed selections resolve to declared column order. Missing, ambiguous or duplicate targets reject before reading rows. Hidden fields and original grid positions are never consulted. If the identifiers and one further column cannot fit, the writer rejects the layout rather than clipping or shrinking it.
|
|
303
304
|
|
|
304
|
-
Each bounded record window is emitted through
|
|
305
|
+
Each bounded record window is emitted through its bands before the next window. Long records share one logical fragment window while each band paints only the height its visible cells need. A continuation band with no remaining non-identifier content is omitted; initial rows, structured spans and link obligations are retained. Repeated identifier cells must fit below the repeated headings and group context on a fresh page; taller identifiers are rejected. A short final fragment retains the full identifier and enough row height to display it. Sources are consumed once, values and formatters are captured once, and numeric totals are accumulated once. Repeated headings, identifiers, links and page decorations still consume the document's physical output budgets. `maxTableBands` defaults to 64 per table; `maxTableWindowRows` defaults to 256 retained row fragments per window. These bounds do not imply constant memory for fonts, page references or caller-owned destinations.
|
|
305
306
|
|
|
306
|
-
The same `wideTable` option applies to `pdfTable`, `writeGroupedPdf` and `pdfGroupedTable`. Grouped tables add a leading label column: repeat `[0,
|
|
307
|
+
The same `wideTable` option applies to `pdfTable`, `writeGroupedPdf` and `pdfGroupedTable`. Grouped tables add a leading label column: repeat `[0, "service"]` to retain that label and the selected service key, or `[0, 1]` for the label and first data position. Continued analytical bands retain the active ancestor context. A deliberately small `maxTableWindowRows` can separate the last detail and closing subtotals even when they would fit on one page; the retained-fragment bound takes precedence. Structured headings and footers preserve their intersecting span labels in each band. An indivisible footer span matrix must fit the window bound and the physical page. With `tagged: { language }`, physical bands share one logical table: cells follow source-column order within each source row, and repeated visual identifiers do not create duplicate logical text.
|
|
307
308
|
|
|
308
309
|
### Display language
|
|
309
310
|
|
|
@@ -523,9 +524,9 @@ const report = await writePdfDocument([
|
|
|
523
524
|
], { tagged: { language: "en-US" } });
|
|
524
525
|
```
|
|
525
526
|
|
|
526
|
-
Column headings use `TH` with column scope; empty heading cells use `TD`. Column groups and `headerRows` preserve horizontal and vertical spans through `ColSpan`/`RowSpan`. Nonempty column headings have identifiers in the document's structure ID tree. Data and footer cells use explicit `Headers` associations to the applicable headings; a cell with no applicable heading has no such association. Structured `footer.rows` preserve their own spans. A table remains one `Table` with ordered `TR` and cell elements across pages and horizontal bands; each continued cell retains its logical identity. Repeated visual headings, identifiers, continuation captions, table borders/backgrounds, page headers/footers and page numbers are artifacts. Inline and whole-cell links use logical `Link` elements associated with their marked content and annotations across wrapping and page continuation; tagged links require a nonempty displayed label. Interactive links in artifact-only continuation captions have one logical alternative label while every visible copy retains its native annotation association.
|
|
527
|
+
Column headings use `TH` with column scope; empty heading cells use `TD`. Set `rowHeader: true` on a detail column to declare row-scope headings. Every ordinary cell references all declared headings in its row, including an identifier that follows a metric after column reordering. Multiple row headings are supported. This metadata does not select or physically repeat a column, infer roles from a caption, or change CSV/XLSX values and formatting. Column groups and `headerRows` preserve horizontal and vertical spans through `ColSpan`/`RowSpan`. Nonempty column headings have identifiers in the document's structure ID tree. Data and footer cells use explicit `Headers` associations to the applicable headings; a cell with no applicable heading has no such association. Structured `footer.rows` preserve their own spans. A table remains one `Table` with ordered `TR` and cell elements across pages and horizontal bands; each continued cell retains its logical identity. Repeated visual headings, identifiers, continuation captions, table borders/backgrounds, page headers/footers and page numbers are artifacts. Inline and whole-cell links use logical `Link` elements associated with their marked content and annotations across wrapping and page continuation; tagged links require a nonempty displayed label. Interactive links in artifact-only continuation captions have one logical alternative label while every visible copy retains its native annotation association.
|
|
527
528
|
|
|
528
|
-
`writeGroupedPdf` and composed `pdfGroupedTable` use nested group sections, visible group headings and native outline entries. Blank labels leave the section in place without an outline entry. `groupHeadingLevel` selects the first group's heading level (default 2); child groups increment it. Use 1 for a titleless report or 3 below an authored H2 section. A hierarchy extending beyond H6 is rejected. Each subtotal belongs to its own group
|
|
529
|
+
`writeGroupedPdf` and composed `pdfGroupedTable` use nested group sections, visible group headings and native outline entries. Blank labels leave the section in place without an outline entry. `groupHeadingLevel` selects the first group's heading level (default 2); child groups increment it. Use 1 for a titleless report or 3 below an authored H2 section. A hierarchy extending beyond H6 is rejected. Each subtotal belongs to its own group and has an explicit row-heading label. A leaf subtotal shares its own detail table and header identities; an ancestor subtotal has a separate table under its ancestor section, and the grand total follows the groups. The last detail and leaf subtotal stay together when the physical page and retained-window limits permit. Labels and continuation text remain caller-authored; the engine never infers semantic roles from language, text prefixes or formatting.
|
|
529
530
|
|
|
530
531
|
Every image, vector or drawing block in tagged output requires either a nonempty `alternativeText` or `decorative: true`. Meaningful graphics become `Figure` elements with an alternative; decorative graphics are artifacts. Supplying both is an error. Figure alternatives count toward the cell/text budgets and obey `maxCellCharacters`. Choose alternatives and heading levels that express the report's meaning; the writer cannot infer them.
|
|
531
532
|
|
|
@@ -593,7 +594,7 @@ async function exportSales(destination: WritableStream<Uint8Array>, signal: Abor
|
|
|
593
594
|
}
|
|
594
595
|
```
|
|
595
596
|
|
|
596
|
-
`writeCsvTo` and `writePdfTo` have the same destination and completion contract. Pass the signal into paged fetching and destination I/O too; rejecting an export does not cancel application-owned I/O automatically. Native Web Streams need no adapter. For Node writable streams, use the platform's `Writable.toWeb` adapter as shown below.
|
|
597
|
+
`writeCsvTo` and `writePdfTo` have the same destination and completion contract. Pass the signal into paged fetching and destination I/O too; rejecting an export does not cancel application-owned I/O automatically. Native Web Streams need no adapter and receive owned chunks that their underlying sink may retain. For Node writable streams, use the platform's `Writable.toWeb` adapter as shown below.
|
|
597
598
|
|
|
598
599
|
Select a caller-owned sink when constructing the workbook to deliver ZIP bytes during row production. Complete streamed worksheets in order: `close()` completes a worksheet explicitly, and starting the next worksheet closes its predecessor. Await each append before switching worksheets. A closed worksheet cannot receive more rows. `finish()` completes the ZIP directory and returns data-row, sheet and byte counts; repeated calls reuse the same result. The row count excludes headings, footers and preservation-sheet records. The sheet count includes the preservation sheet when present.
|
|
599
600
|
|
|
@@ -962,7 +963,7 @@ XLSX emits native outline controls and finite `SUBTOTAL` formulas with initial c
|
|
|
962
963
|
|
|
963
964
|
For PDF, create a fresh source and call `writeGroupedPdf` or `writeGroupedPdfTo` from the same `/pdf` entry. These convenience writers use the same composed-document owner as `pdfGroupedTable`. The required `labelColumn`, `subtotalLabel` and `grandTotalLabel` remain host-authored; ordinary PDF fonts, layout and display options apply. Continued pages repeat the full active ancestor path and leaf headings. `continuationLabel` supplies display text for each active group. Empty reports retain requested headings with or without a grand total.
|
|
964
965
|
|
|
965
|
-
Untagged output keeps the last detail row and its closing subtotals together when the bundle fits a fresh page; oversized bundles use ordinary row splitting under repeated context. The [tagged profile](#tagged-pdf-reports) nests group sections and gives nonblank labels a visible heading and navigation entry.
|
|
966
|
+
Untagged output keeps the last detail row and its closing subtotals together when the bundle fits a fresh page; oversized bundles use ordinary row splitting under repeated context. The [tagged profile](#tagged-pdf-reports) nests group sections and gives nonblank labels a visible heading and navigation entry. A leaf subtotal shares its detail table and column headings; an ancestor subtotal uses a separate summary table under that ancestor's section, and the grand total follows the groups. Each summary row has a row-heading label associated with its values. Separate ancestor and grand-summary tables show the label and declared aggregate columns, including zero or blank results, with their own headings; detail-only fields do not create empty summary bands. The opening path is painted once by group headings and existing ancestor context, then repeated in full on later bands and pages. This presentation can use more space than the compact untagged layout. `groupHeadingLevel` sets the outer group's heading level, defaulting to 2; child groups increment it. Use 1 for a titleless report or 3 beneath an authored H2 section. An opened hierarchy extending beyond H6 fails explicitly.
|
|
966
967
|
|
|
967
968
|
`writeGroupedXlsxTo` and `writeGroupedPdfTo` await caller-owned destinations. Source and writer cancellation reach pending reads and writes; progress/result `rows` count data records. Generated group and summary rows still consume the format writer's row/cell/text budgets. Source `limits` cover only rows, cells and text; set `maxOutputBytes` on the selected writer. `maxGroups` defaults to 1,000 across all opened nodes, and `maxGroupKeyCharacters` to 1,000,000 retained UTF-16 units. The engine retains parent-scoped identifiers for recurrence detection, depth-bounded aggregate state and one boundary lookahead, rather than group bodies.
|
|
968
969
|
|
|
@@ -1020,6 +1021,8 @@ Group events expose zero-based `level` and a captured `path` containing all acti
|
|
|
1020
1021
|
|
|
1021
1022
|
The [complete analytical report example](../OfficeIMO.JavaScript.Examples/analytical-report-job.mjs) combines hidden grouping fields, detail-only editing rules, an editable overview chart and multi-section PDF output. Its worker input is ordinary flat projected rows: visible values followed by explicitly selected grouping scalars. Those metadata fields consume the same worker cell/text budgets; callbacks are reconstructed in the worker. It has explicit English and Polish example resources, while the engine's keys, grouping and numeric semantics remain language independent.
|
|
1022
1023
|
|
|
1024
|
+
The [HtmlForgeX operational inventory example](../OfficeIMO.JavaScript.Examples/OperationalInventoryExample.cs) generates a typed table with selection, filtering and column reordering. Its host captures the current view and sends portable values and explicit column metadata to a worker using the public grouped XLSX/PDF writers. Stable service keys identify repeated PDF columns and row headings; the table's presentation remains under the host's control.
|
|
1025
|
+
|
|
1023
1026
|
## Live Excel conditional formatting
|
|
1024
1027
|
|
|
1025
1028
|
`conditionalFormats` writes native Excel rules that recalculate when users edit workbook values. Use these alongside resolved row/cell highlights when the report needs both an exported appearance and live spreadsheet behavior:
|