reamkit 1.15.1 → 1.15.2
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/dist/esm/core/arc-to-bezier.d.ts +23 -0
- package/dist/esm/core/arc-to-bezier.js +23 -0
- package/dist/esm/core/bidi/algorithm.d.ts +26 -0
- package/dist/esm/core/bidi/algorithm.js +21 -0
- package/dist/esm/core/bidi/char-types.d.ts +17 -0
- package/dist/esm/core/bidi/char-types.js +10 -0
- package/dist/esm/core/bidi/index.d.ts +42 -0
- package/dist/esm/core/bidi/index.js +27 -0
- package/dist/esm/core/bidi/segments.d.ts +22 -0
- package/dist/esm/core/bidi/segments.js +14 -0
- package/dist/esm/core/bytes.d.ts +9 -0
- package/dist/esm/core/bytes.js +9 -0
- package/dist/esm/core/converter/facade.d.ts +38 -1
- package/dist/esm/core/converter/facade.js +25 -0
- package/dist/esm/core/converter/project.d.ts +12 -0
- package/dist/esm/core/converter/project.js +11 -0
- package/dist/esm/core/converter/ream.d.ts +107 -0
- package/dist/esm/core/converter/ream.js +76 -0
- package/dist/esm/core/crypto/asn1.d.ts +77 -0
- package/dist/esm/core/crypto/asn1.js +65 -0
- package/dist/esm/core/crypto/cms.d.ts +25 -0
- package/dist/esm/core/crypto/cms.js +8 -0
- package/dist/esm/core/document-model/index.d.ts +7 -0
- package/dist/esm/core/document-model/types.d.ts +328 -0
- package/dist/esm/core/drawingml/chart-geometry.d.ts +125 -0
- package/dist/esm/core/drawingml/chart-geometry.js +96 -0
- package/dist/esm/core/drawingml/chart-parser.d.ts +34 -0
- package/dist/esm/core/drawingml/chart-parser.js +34 -0
- package/dist/esm/core/drawingml/chart-serializer.d.ts +12 -0
- package/dist/esm/core/drawingml/chart-serializer.js +12 -0
- package/dist/esm/core/drawingml/colors.d.ts +53 -0
- package/dist/esm/core/drawingml/colors.js +41 -0
- package/dist/esm/core/drawingml/preset-geometry.d.ts +30 -0
- package/dist/esm/core/drawingml/preset-geometry.js +30 -0
- package/dist/esm/core/drawingml/shape-render.d.ts +54 -0
- package/dist/esm/core/drawingml/shape-render.js +54 -0
- package/dist/esm/core/drawingml/sparkline-geometry.d.ts +15 -0
- package/dist/esm/core/drawingml/sparkline-geometry.js +13 -0
- package/dist/esm/core/drawingml/theme-parser.d.ts +11 -0
- package/dist/esm/core/drawingml/theme-parser.js +11 -0
- package/dist/esm/core/font/arabic-joining.d.ts +21 -0
- package/dist/esm/core/font/arabic-joining.js +16 -0
- package/dist/esm/core/font/binary-reader.d.ts +17 -0
- package/dist/esm/core/font/binary-reader.js +17 -0
- package/dist/esm/core/font/font-registry.d.ts +37 -0
- package/dist/esm/core/font/font-registry.js +31 -0
- package/dist/esm/core/font/measure.d.ts +20 -0
- package/dist/esm/core/font/measure.js +11 -0
- package/dist/esm/core/font/opentype-layout.d.ts +49 -0
- package/dist/esm/core/font/opentype-layout.js +37 -0
- package/dist/esm/core/font/ttf-parser.d.ts +32 -0
- package/dist/esm/core/font/ttf-parser.js +7 -0
- package/dist/esm/core/font/ttf-subset.d.ts +21 -0
- package/dist/esm/core/font/ttf-subset.js +21 -0
- package/dist/esm/core/fonts/provider.d.ts +8 -1
- package/dist/esm/core/fonts/provider.js +1 -0
- package/dist/esm/core/fonts/remote-fonts.d.ts +22 -0
- package/dist/esm/core/fonts/remote-fonts.js +16 -0
- package/dist/esm/core/hyphenation/index.d.ts +25 -0
- package/dist/esm/core/hyphenation/index.js +17 -0
- package/dist/esm/core/hyphenation/liang.d.ts +27 -0
- package/dist/esm/core/hyphenation/liang.js +14 -0
- package/dist/esm/core/images.d.ts +32 -0
- package/dist/esm/core/images.js +12 -0
- package/dist/esm/core/ir/adapters.d.ts +23 -0
- package/dist/esm/core/ir/features.d.ts +8 -0
- package/dist/esm/core/ir/features.js +1 -0
- package/dist/esm/core/ir/flow.d.ts +20 -0
- package/dist/esm/core/ir/index.d.ts +7 -0
- package/dist/esm/core/ir/loss.d.ts +12 -0
- package/dist/esm/core/ir/loss.js +8 -0
- package/dist/esm/core/ir/resources.d.ts +12 -0
- package/dist/esm/core/ir/resources.js +11 -0
- package/dist/esm/core/ir/sheet.d.ts +81 -0
- package/dist/esm/core/ir/units.d.ts +9 -0
- package/dist/esm/core/ir/units.js +2 -0
- package/dist/esm/core/line-breaker/cjk.d.ts +26 -0
- package/dist/esm/core/line-breaker/cjk.js +60 -0
- package/dist/esm/core/line-breaker/greedy.d.ts +14 -0
- package/dist/esm/core/line-breaker/greedy.js +14 -0
- package/dist/esm/core/line-breaker/index.d.ts +1 -0
- package/dist/esm/core/line-breaker/index.js +3 -0
- package/dist/esm/core/line-breaker/knuth-plass.d.ts +29 -5
- package/dist/esm/core/line-breaker/knuth-plass.js +10 -5
- package/dist/esm/core/numbering/apply.d.ts +19 -0
- package/dist/esm/core/numbering/apply.js +19 -0
- package/dist/esm/core/numbering/state.d.ts +15 -0
- package/dist/esm/core/numbering/state.js +15 -0
- package/dist/esm/core/ole/cfb.d.ts +19 -0
- package/dist/esm/core/ole/cfb.js +16 -0
- package/dist/esm/core/opc/core-properties.d.ts +12 -0
- package/dist/esm/core/opc/core-properties.js +5 -0
- package/dist/esm/core/opc/opc-writer.d.ts +24 -4
- package/dist/esm/core/opc/opc-writer.js +12 -0
- package/dist/esm/core/opc/package.d.ts +55 -0
- package/dist/esm/core/opc/package.js +46 -0
- package/dist/esm/core/opc/relationship-types.d.ts +8 -0
- package/dist/esm/core/opc/relationship-types.js +5 -0
- package/dist/esm/core/opc/relationships.d.ts +12 -0
- package/dist/esm/core/opc/relationships.js +7 -0
- package/dist/esm/core/po-helpers.d.ts +38 -0
- package/dist/esm/core/po-helpers.js +33 -0
- package/dist/esm/core/spreadsheet-model/types.d.ts +281 -0
- package/dist/esm/core/style-cascade/resolver.d.ts +31 -0
- package/dist/esm/core/style-cascade/resolver.js +31 -0
- package/dist/esm/core/style-cascade/table.d.ts +7 -0
- package/dist/esm/core/style-cascade/table.js +7 -0
- package/dist/esm/core/style-cascade/types.d.ts +27 -0
- package/dist/esm/core/style-cascade/types.js +2 -0
- package/dist/esm/core/vector.d.ts +67 -0
- package/dist/esm/core/vector.js +23 -0
- package/dist/esm/excel/activex-parser.d.ts +31 -0
- package/dist/esm/excel/activex-parser.js +24 -0
- package/dist/esm/excel/cell-reference.d.ts +14 -0
- package/dist/esm/excel/cell-reference.js +9 -0
- package/dist/esm/excel/column-bands.d.ts +29 -0
- package/dist/esm/excel/column-bands.js +26 -0
- package/dist/esm/excel/comments-parser.d.ts +19 -0
- package/dist/esm/excel/comments-parser.js +19 -0
- package/dist/esm/excel/conditional-format.d.ts +38 -0
- package/dist/esm/excel/conditional-format.js +25 -0
- package/dist/esm/excel/defined-name-ref.d.ts +21 -0
- package/dist/esm/excel/defined-name-ref.js +20 -0
- package/dist/esm/excel/form-control-parser.d.ts +13 -0
- package/dist/esm/excel/form-control-parser.js +5 -0
- package/dist/esm/excel/formula/context.d.ts +37 -0
- package/dist/esm/excel/formula/dates.d.ts +23 -0
- package/dist/esm/excel/formula/dates.js +20 -0
- package/dist/esm/excel/formula/eval.d.ts +21 -0
- package/dist/esm/excel/formula/eval.js +11 -0
- package/dist/esm/excel/formula/functions.d.ts +12 -0
- package/dist/esm/excel/formula/functions.js +12 -0
- package/dist/esm/excel/formula/index.d.ts +21 -0
- package/dist/esm/excel/formula/index.js +16 -0
- package/dist/esm/excel/formula/lexer.d.ts +12 -0
- package/dist/esm/excel/formula/lexer.js +10 -0
- package/dist/esm/excel/formula/parser.d.ts +20 -0
- package/dist/esm/excel/formula/parser.js +53 -0
- package/dist/esm/excel/formula/value.d.ts +53 -0
- package/dist/esm/excel/formula/value.js +30 -0
- package/dist/esm/excel/header-footer.d.ts +9 -0
- package/dist/esm/excel/header-footer.js +9 -0
- package/dist/esm/excel/number-format.d.ts +34 -0
- package/dist/esm/excel/number-format.js +34 -0
- package/dist/esm/excel/pivot-table-parser.d.ts +8 -0
- package/dist/esm/excel/pivot-table-parser.js +8 -0
- package/dist/esm/excel/print-model.d.ts +56 -0
- package/dist/esm/excel/print-model.js +43 -0
- package/dist/esm/excel/shared-strings-parser.d.ts +13 -0
- package/dist/esm/excel/shared-strings-parser.js +5 -0
- package/dist/esm/excel/sheet-drawing.d.ts +34 -0
- package/dist/esm/excel/sheet-drawing.js +21 -0
- package/dist/esm/excel/sheet-shape-parser.d.ts +12 -0
- package/dist/esm/excel/sheet-shape-parser.js +12 -0
- package/dist/esm/excel/sheet-to-flow.d.ts +19 -0
- package/dist/esm/excel/sheet-to-flow.js +10 -0
- package/dist/esm/excel/slicer-parser.d.ts +23 -0
- package/dist/esm/excel/slicer-parser.js +10 -0
- package/dist/esm/excel/styles-parser.d.ts +8 -0
- package/dist/esm/excel/styles-parser.js +8 -0
- package/dist/esm/excel/table-parser.d.ts +24 -0
- package/dist/esm/excel/table-parser.js +5 -0
- package/dist/esm/excel/workbook-parser.d.ts +17 -0
- package/dist/esm/excel/workbook-parser.js +5 -0
- package/dist/esm/excel/worksheet-parser.d.ts +9 -0
- package/dist/esm/excel/worksheet-parser.js +9 -0
- package/dist/esm/excel/xls/biff-chart.d.ts +10 -0
- package/dist/esm/excel/xls/biff-chart.js +10 -0
- package/dist/esm/excel/xls/biff-reader.d.ts +27 -0
- package/dist/esm/excel/xls/biff-reader.js +44 -0
- package/dist/esm/excel/xls/biff-styles.d.ts +20 -0
- package/dist/esm/excel/xls/biff-styles.js +20 -0
- package/dist/esm/excel/xls/escher.d.ts +27 -0
- package/dist/esm/excel/xls/escher.js +18 -0
- package/dist/esm/excel/xls/xls-reader.d.ts +6 -0
- package/dist/esm/excel/xls/xls-reader.js +6 -0
- package/dist/esm/excel/xlsx-reader.d.ts +26 -0
- package/dist/esm/excel/xlsx-reader.js +26 -0
- package/dist/esm/excel/xlsx-to-pdf.d.ts +27 -0
- package/dist/esm/excel/xlsx-writer.d.ts +14 -0
- package/dist/esm/excel/xlsx-writer.js +13 -0
- package/dist/esm/html/html-writer.d.ts +18 -0
- package/dist/esm/html/html-writer.js +18 -0
- package/dist/esm/index.d.ts +23 -0
- package/dist/esm/layout/math-layout.d.ts +39 -0
- package/dist/esm/layout/math-layout.js +18 -0
- package/dist/esm/layout/page-doc.d.ts +91 -0
- package/dist/esm/layout/styled-layout.d.ts +175 -0
- package/dist/esm/layout/styled-layout.js +117 -2
- package/dist/esm/pdf/builtin-fonts.d.ts +5 -0
- package/dist/esm/pdf/cid-font.d.ts +22 -0
- package/dist/esm/pdf/cid-font.js +10 -0
- package/dist/esm/pdf/embedded-file.d.ts +16 -0
- package/dist/esm/pdf/embedded-file.js +9 -0
- package/dist/esm/pdf/encryption.d.ts +59 -0
- package/dist/esm/pdf/encryption.js +37 -0
- package/dist/esm/pdf/icc-profile.d.ts +8 -0
- package/dist/esm/pdf/icc-profile.js +8 -0
- package/dist/esm/pdf/image-xobject.d.ts +19 -0
- package/dist/esm/pdf/image-xobject.js +9 -0
- package/dist/esm/pdf/objects.d.ts +40 -0
- package/dist/esm/pdf/objects.js +36 -0
- package/dist/esm/pdf/serialize.d.ts +18 -0
- package/dist/esm/pdf/serialize.js +18 -0
- package/dist/esm/pdf/shading.d.ts +16 -0
- package/dist/esm/pdf/shading.js +16 -0
- package/dist/esm/pdf/signature.d.ts +36 -0
- package/dist/esm/pdf/signature.js +22 -0
- package/dist/esm/pdf/struct-tree.d.ts +64 -0
- package/dist/esm/pdf/struct-tree.js +60 -0
- package/dist/esm/pdf/styled-page-emitter.d.ts +33 -0
- package/dist/esm/pdf/styled-page-emitter.js +21 -0
- package/dist/esm/pdf/styled-page-renderer.d.ts +18 -0
- package/dist/esm/pdf/styled-page-renderer.js +18 -0
- package/dist/esm/pdf/text-encoding.d.ts +16 -0
- package/dist/esm/pdf/text-page-renderer.d.ts +11 -0
- package/dist/esm/pdf/vector-graphics.d.ts +12 -0
- package/dist/esm/pdf/vector-graphics.js +12 -0
- package/dist/esm/pdf/writer.d.ts +39 -0
- package/dist/esm/pdf/writer.js +27 -0
- package/dist/esm/pdf/xmp.d.ts +16 -0
- package/dist/esm/pdf/xmp.js +9 -0
- package/dist/esm/pdf-reader/ccitt.d.ts +25 -0
- package/dist/esm/pdf-reader/ccitt.js +15 -0
- package/dist/esm/pdf-reader/cmap.d.ts +12 -0
- package/dist/esm/pdf-reader/cmap.js +9 -0
- package/dist/esm/pdf-reader/content.d.ts +69 -0
- package/dist/esm/pdf-reader/content.js +16 -0
- package/dist/esm/pdf-reader/crypto.d.ts +5 -0
- package/dist/esm/pdf-reader/crypto.js +5 -0
- package/dist/esm/pdf-reader/decrypt.d.ts +17 -0
- package/dist/esm/pdf-reader/decrypt.js +12 -0
- package/dist/esm/pdf-reader/document.d.ts +53 -0
- package/dist/esm/pdf-reader/document.js +50 -0
- package/dist/esm/pdf-reader/flow-build.d.ts +47 -0
- package/dist/esm/pdf-reader/flow-build.js +42 -0
- package/dist/esm/pdf-reader/font.d.ts +12 -0
- package/dist/esm/pdf-reader/font.js +12 -0
- package/dist/esm/pdf-reader/image-decode.d.ts +21 -0
- package/dist/esm/pdf-reader/image-decode.js +14 -0
- package/dist/esm/pdf-reader/images.d.ts +19 -0
- package/dist/esm/pdf-reader/images.js +9 -0
- package/dist/esm/pdf-reader/layout.d.ts +15 -0
- package/dist/esm/pdf-reader/layout.js +15 -0
- package/dist/esm/pdf-reader/lexer.d.ts +43 -0
- package/dist/esm/pdf-reader/lexer.js +38 -0
- package/dist/esm/pdf-reader/parser.d.ts +15 -0
- package/dist/esm/pdf-reader/parser.js +8 -0
- package/dist/esm/pdf-reader/png-encode.d.ts +9 -0
- package/dist/esm/pdf-reader/png-encode.js +8 -0
- package/dist/esm/pdf-reader/predictor.d.ts +9 -0
- package/dist/esm/pdf-reader/predictor.js +8 -0
- package/dist/esm/pdf-reader/reader.d.ts +16 -0
- package/dist/esm/pdf-reader/reader.js +16 -0
- package/dist/esm/pdf-reader/shading.d.ts +10 -0
- package/dist/esm/pdf-reader/shading.js +10 -0
- package/dist/esm/pdf-reader/struct-tree.d.ts +24 -0
- package/dist/esm/pdf-reader/struct-tree.js +12 -0
- package/dist/esm/pdf-reader/tagged.d.ts +13 -0
- package/dist/esm/pdf-reader/tagged.js +13 -0
- package/dist/esm/pdf-reader/text.d.ts +11 -0
- package/dist/esm/pdf-reader/text.js +11 -0
- package/dist/esm/pdf-reader/vector.d.ts +19 -0
- package/dist/esm/pdf-reader/vector.js +9 -0
- package/dist/esm/pptx/placeholder-cascade.d.ts +21 -0
- package/dist/esm/pptx/placeholder-cascade.js +10 -0
- package/dist/esm/pptx/ppt/ppt-reader.d.ts +16 -0
- package/dist/esm/pptx/ppt/ppt-reader.js +16 -0
- package/dist/esm/pptx/ppt/ppt-text.d.ts +55 -0
- package/dist/esm/pptx/ppt/ppt-text.js +14 -0
- package/dist/esm/pptx/pptx-reader.d.ts +21 -0
- package/dist/esm/pptx/pptx-reader.js +21 -0
- package/dist/esm/pptx/slide-parser.d.ts +102 -0
- package/dist/esm/pptx/slide-parser.js +78 -0
- package/dist/esm/pptx/sp-helpers.d.ts +28 -0
- package/dist/esm/pptx/sp-helpers.js +22 -0
- package/dist/esm/svg/svg-writer.d.ts +17 -0
- package/dist/esm/svg/svg-writer.js +16 -0
- package/dist/esm/word/doc/doc-reader.d.ts +16 -0
- package/dist/esm/word/doc/doc-reader.js +16 -0
- package/dist/esm/word/doc/doc-text.d.ts +77 -0
- package/dist/esm/word/doc/doc-text.js +13 -0
- package/dist/esm/word/document-parser.d.ts +134 -0
- package/dist/esm/word/document-parser.js +86 -0
- package/dist/esm/word/docx-reader.d.ts +16 -0
- package/dist/esm/word/docx-reader.js +16 -0
- package/dist/esm/word/docx-to-pdf.d.ts +52 -0
- package/dist/esm/word/docx-to-pdf.js +21 -0
- package/dist/esm/word/docx-writer.d.ts +17 -0
- package/dist/esm/word/docx-writer.js +17 -0
- package/dist/esm/word/drawing-parser.d.ts +88 -0
- package/dist/esm/word/drawing-parser.js +68 -0
- package/dist/esm/word/font-table.d.ts +24 -0
- package/dist/esm/word/font-table.js +24 -0
- package/dist/esm/word/numbering-parser.d.ts +11 -0
- package/dist/esm/word/numbering-parser.js +11 -0
- package/dist/esm/word/omml-parser.d.ts +15 -0
- package/dist/esm/word/omml-parser.js +15 -0
- package/dist/esm/word/omml-serializer.d.ts +9 -0
- package/dist/esm/word/omml-serializer.js +9 -0
- package/dist/esm/word/paragraph-properties.d.ts +10 -0
- package/dist/esm/word/paragraph-properties.js +10 -0
- package/dist/esm/word/po-to-flat.d.ts +11 -0
- package/dist/esm/word/po-to-flat.js +11 -0
- package/dist/esm/word/run-properties.d.ts +10 -0
- package/dist/esm/word/run-properties.js +10 -0
- package/dist/esm/word/settings-parser.d.ts +13 -0
- package/dist/esm/word/settings-parser.js +8 -0
- package/dist/esm/word/styles-parser.d.ts +10 -0
- package/dist/esm/word/styles-parser.js +10 -0
- package/dist/esm/word/table-parser.d.ts +11 -0
- package/dist/esm/word/table-parser.js +11 -0
- package/dist/esm/word/text-extractor.d.ts +9 -0
- package/dist/esm/word/xml-helpers.d.ts +44 -0
- package/dist/esm/word/xml-helpers.js +38 -0
- package/package.json +1 -1
|
@@ -8,6 +8,11 @@ var parser = new XMLParser({
|
|
|
8
8
|
parseTagValue: false,
|
|
9
9
|
removeNSPrefix: true
|
|
10
10
|
});
|
|
11
|
+
/**
|
|
12
|
+
* Parse `xl/slicers/slicerN.xml` into its {@link SlicerDef} panels (caption,
|
|
13
|
+
* column count, style, cache name). A slicer missing a name or cache name is
|
|
14
|
+
* skipped.
|
|
15
|
+
*/
|
|
11
16
|
function parseSlicerPart(data) {
|
|
12
17
|
const root = asObj(parser.parse(decoder.decode(data))["slicers"]);
|
|
13
18
|
if (!root) return [];
|
|
@@ -30,6 +35,11 @@ function parseSlicerPart(data) {
|
|
|
30
35
|
}
|
|
31
36
|
return out;
|
|
32
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse `xl/slicerCaches/slicerCacheN.xml` into a {@link SlicerCacheDef}, resolving
|
|
40
|
+
* a native-table source (`extLst → ext → slicerCacheDefinition → tableSlicerCache`)
|
|
41
|
+
* to its `tableId` + column. Returns undefined when the root or its name is missing.
|
|
42
|
+
*/
|
|
33
43
|
function parseSlicerCachePart(data) {
|
|
34
44
|
const root = asObj(parser.parse(decoder.decode(data))["slicerCacheDefinition"]);
|
|
35
45
|
if (!root) return void 0;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { XlsxStyles } from '../core/spreadsheet-model/index.js';
|
|
2
|
+
/** The empty style table, returned for a workbook with no (or a malformed) `styles.xml`. */
|
|
2
3
|
export declare const EMPTY_XLSX_STYLES: XlsxStyles;
|
|
4
|
+
/**
|
|
5
|
+
* Parse `xl/styles.xml` (§18.8) into the {@link XlsxStyles} table the renderer
|
|
6
|
+
* consumes: custom number formats, fonts, fills, borders, the cell formats
|
|
7
|
+
* (`cellXfs` — each indexing font/fill/border/numFmt + optional alignment) and the
|
|
8
|
+
* differential formats (`dxfs`) conditional formatting applies. Returns
|
|
9
|
+
* {@link EMPTY_XLSX_STYLES} when the root is absent or malformed.
|
|
10
|
+
*/
|
|
3
11
|
export declare function parseXlsxStyles(data: Uint8Array): XlsxStyles;
|
|
@@ -10,6 +10,7 @@ var parser = new XMLParser({
|
|
|
10
10
|
trimValues: false,
|
|
11
11
|
removeNSPrefix: true
|
|
12
12
|
});
|
|
13
|
+
/** The empty style table, returned for a workbook with no (or a malformed) `styles.xml`. */
|
|
13
14
|
var EMPTY_XLSX_STYLES = {
|
|
14
15
|
numFmts: /* @__PURE__ */ new Map(),
|
|
15
16
|
fonts: [],
|
|
@@ -17,6 +18,13 @@ var EMPTY_XLSX_STYLES = {
|
|
|
17
18
|
borders: [],
|
|
18
19
|
cellXfs: []
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Parse `xl/styles.xml` (§18.8) into the {@link XlsxStyles} table the renderer
|
|
23
|
+
* consumes: custom number formats, fonts, fills, borders, the cell formats
|
|
24
|
+
* (`cellXfs` — each indexing font/fill/border/numFmt + optional alignment) and the
|
|
25
|
+
* differential formats (`dxfs`) conditional formatting applies. Returns
|
|
26
|
+
* {@link EMPTY_XLSX_STYLES} when the root is absent or malformed.
|
|
27
|
+
*/
|
|
20
28
|
function parseXlsxStyles(data) {
|
|
21
29
|
const xml = decoder.decode(data);
|
|
22
30
|
const root = asObject(parser.parse(xml)["styleSheet"]);
|
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import { ExcelTable } from '../core/spreadsheet-model/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* §18.5.1.1 `<autoFilter><filterColumn colId><filters><filter val>` — the values
|
|
4
|
+
* a column's filter keeps visible. Used only for slicer selection (E-SHEET SV2);
|
|
5
|
+
* not part of the persisted {@link ExcelTable} (so the writer/roundtrip stay
|
|
6
|
+
* unchanged).
|
|
7
|
+
*/
|
|
2
8
|
export interface TableFilterColumn {
|
|
9
|
+
/** 0-based column offset within the table. */
|
|
3
10
|
readonly colId: number;
|
|
11
|
+
/** The values the filter keeps visible. */
|
|
4
12
|
readonly values: ReadonlyArray<string>;
|
|
5
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The richer parse the reader needs for slicer resolution: the persisted
|
|
16
|
+
* {@link ExcelTable} plus the table's numeric id and any autofilter value filters.
|
|
17
|
+
*/
|
|
6
18
|
export interface ParsedTablePart {
|
|
7
19
|
readonly table: ExcelTable;
|
|
20
|
+
/** The table's numeric `@id` (matched against a slicer cache's `tableId`). */
|
|
8
21
|
readonly id?: number;
|
|
9
22
|
readonly filters: ReadonlyArray<TableFilterColumn>;
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse `xl/tables/tableN.xml` (§18.5.1.2) into the persisted {@link ExcelTable}
|
|
26
|
+
* (range, header-row count, autofilter presence, banded-style flags), or undefined
|
|
27
|
+
* when the root or its `ref` is missing. The slimmer of the two entry points;
|
|
28
|
+
* {@link parseTablePartFull} also returns the id + filters.
|
|
29
|
+
*/
|
|
11
30
|
export declare function parseTablePart(data: Uint8Array): ExcelTable | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Parse a table part into the full {@link ParsedTablePart} — the {@link ExcelTable}
|
|
33
|
+
* plus the table's numeric id and any autofilter value filters (for slicer
|
|
34
|
+
* resolution). Returns undefined when the root or its `ref` is missing.
|
|
35
|
+
*/
|
|
12
36
|
export declare function parseTablePartFull(data: Uint8Array): ParsedTablePart | undefined;
|
|
@@ -9,6 +9,11 @@ var parser = new XMLParser({
|
|
|
9
9
|
parseTagValue: false,
|
|
10
10
|
removeNSPrefix: true
|
|
11
11
|
});
|
|
12
|
+
/**
|
|
13
|
+
* Parse a table part into the full {@link ParsedTablePart} — the {@link ExcelTable}
|
|
14
|
+
* plus the table's numeric id and any autofilter value filters (for slicer
|
|
15
|
+
* resolution). Returns undefined when the root or its `ref` is missing.
|
|
16
|
+
*/
|
|
12
17
|
function parseTablePartFull(data) {
|
|
13
18
|
const t = asObj(parser.parse(decoder.decode(data))["table"]);
|
|
14
19
|
if (!t) return void 0;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { DefinedName } from '../core/spreadsheet-model/index.js';
|
|
2
|
+
/** §18.2.19 `<sheet name sheetId r:id>` — one worksheet reference in tab order. */
|
|
2
3
|
export interface SheetReference {
|
|
4
|
+
/** The sheet (tab) display name. */
|
|
3
5
|
readonly name: string;
|
|
6
|
+
/** The workbook-internal sheet id (`@sheetId`); `''` when absent. */
|
|
4
7
|
readonly sheetId: string;
|
|
8
|
+
/** The relationship id (`r:id`) resolving to the sheet's worksheet part. */
|
|
5
9
|
readonly relationshipId: string;
|
|
6
10
|
}
|
|
11
|
+
/** The parsed `workbook.xml`: the ordered sheet list, the date epoch and defined names. */
|
|
7
12
|
export interface ParsedWorkbook {
|
|
13
|
+
/** The worksheet references in tab order. */
|
|
8
14
|
readonly sheets: ReadonlyArray<SheetReference>;
|
|
15
|
+
/**
|
|
16
|
+
* ECMA-376 Part 1 §18.2.28 — `<workbookPr date1904="1"/>`. When true the
|
|
17
|
+
* serial-to-date conversion uses 1904-01-01 as day 0 instead of the
|
|
18
|
+
* standard 1899-12-30 epoch (legacy Mac Excel files).
|
|
19
|
+
*/
|
|
9
20
|
readonly date1904: boolean;
|
|
21
|
+
/** §18.2.5 workbook defined names (print areas/titles, named ranges). */
|
|
10
22
|
readonly definedNames: ReadonlyArray<DefinedName>;
|
|
11
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse `workbook.xml` into its ordered {@link SheetReference} list plus the date
|
|
26
|
+
* epoch and {@link ParsedWorkbook.definedNames}. A sheet entry missing a name or
|
|
27
|
+
* relationship id is skipped; a malformed root yields an empty workbook.
|
|
28
|
+
*/
|
|
12
29
|
export declare function parseWorkbook(data: Uint8Array): ParsedWorkbook;
|
|
@@ -10,6 +10,11 @@ var parser = new XMLParser({
|
|
|
10
10
|
trimValues: false,
|
|
11
11
|
removeNSPrefix: true
|
|
12
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* Parse `workbook.xml` into its ordered {@link SheetReference} list plus the date
|
|
15
|
+
* epoch and {@link ParsedWorkbook.definedNames}. A sheet entry missing a name or
|
|
16
|
+
* relationship id is skipped; a malformed root yields an empty workbook.
|
|
17
|
+
*/
|
|
13
18
|
function parseWorkbook(data) {
|
|
14
19
|
const xml = decoder.decode(data);
|
|
15
20
|
const workbook = parser.parse(xml)["workbook"];
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { ParsedWorksheet } from '../core/spreadsheet-model/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse `worksheet.xml` (§18.3.1.99) into a {@link ParsedWorksheet}: a flat list
|
|
4
|
+
* of cells with absolute row/column addresses and their raw stored values, plus
|
|
5
|
+
* the per-sheet geometry and print model (columns, merges, row heights,
|
|
6
|
+
* pageMargins/pageSetup, breaks, frozen pane, conditional formats, data
|
|
7
|
+
* validations, hyperlinks, header/footer, form controls, OLE objects, sparklines
|
|
8
|
+
* and table parts). `r=` is optional on `<row>`/`<c>`; absent indices are inferred
|
|
9
|
+
* from document order. A malformed root or missing `sheetData` yields an empty grid.
|
|
10
|
+
*/
|
|
2
11
|
export declare function parseWorksheet(data: Uint8Array): ParsedWorksheet;
|
|
@@ -12,6 +12,15 @@ var parser = new XMLParser({
|
|
|
12
12
|
trimValues: false,
|
|
13
13
|
removeNSPrefix: true
|
|
14
14
|
});
|
|
15
|
+
/**
|
|
16
|
+
* Parse `worksheet.xml` (§18.3.1.99) into a {@link ParsedWorksheet}: a flat list
|
|
17
|
+
* of cells with absolute row/column addresses and their raw stored values, plus
|
|
18
|
+
* the per-sheet geometry and print model (columns, merges, row heights,
|
|
19
|
+
* pageMargins/pageSetup, breaks, frozen pane, conditional formats, data
|
|
20
|
+
* validations, hyperlinks, header/footer, form controls, OLE objects, sparklines
|
|
21
|
+
* and table parts). `r=` is optional on `<row>`/`<c>`; absent indices are inferred
|
|
22
|
+
* from document order. A malformed root or missing `sheetData` yields an empty grid.
|
|
23
|
+
*/
|
|
15
24
|
function parseWorksheet(data) {
|
|
16
25
|
const xml = decoder.decode(data);
|
|
17
26
|
const worksheet = parser.parse(xml)["worksheet"];
|
|
@@ -4,5 +4,15 @@ interface Rec {
|
|
|
4
4
|
readonly type: number;
|
|
5
5
|
readonly data: Uint8Array;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Parse a BIFF chart substream (XLS-6) into a {@link Chart}. The series values
|
|
9
|
+
* are read straight from the host sheet's cells through each series' AI ranges
|
|
10
|
+
* (BIFF caches no plotted numbers, unlike OOXML).
|
|
11
|
+
*
|
|
12
|
+
* @param records The chart substream's records (between its BOF…EOF).
|
|
13
|
+
* @param cells The host sheet's cells (the value source for AI ranges).
|
|
14
|
+
* @param sharedStrings The workbook shared strings (for category / name text).
|
|
15
|
+
* @returns The chart, or `undefined` when there are no series to plot.
|
|
16
|
+
*/
|
|
7
17
|
export declare function parseBiffChart(records: ReadonlyArray<Rec>, cells: ReadonlyArray<WorksheetCell>, sharedStrings: ReadonlyArray<string>): Chart | undefined;
|
|
8
18
|
export {};
|
|
@@ -8,6 +8,16 @@ var REC_SERIES = 4099;
|
|
|
8
8
|
var REC_AI = 4177;
|
|
9
9
|
var REC_SERIESTEXT = 4109;
|
|
10
10
|
var COLS = 16384;
|
|
11
|
+
/**
|
|
12
|
+
* Parse a BIFF chart substream (XLS-6) into a {@link Chart}. The series values
|
|
13
|
+
* are read straight from the host sheet's cells through each series' AI ranges
|
|
14
|
+
* (BIFF caches no plotted numbers, unlike OOXML).
|
|
15
|
+
*
|
|
16
|
+
* @param records The chart substream's records (between its BOF…EOF).
|
|
17
|
+
* @param cells The host sheet's cells (the value source for AI ranges).
|
|
18
|
+
* @param sharedStrings The workbook shared strings (for category / name text).
|
|
19
|
+
* @returns The chart, or `undefined` when there are no series to plot.
|
|
20
|
+
*/
|
|
11
21
|
function parseBiffChart(records, cells, sharedStrings) {
|
|
12
22
|
let type = "unknown";
|
|
13
23
|
let barDir;
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { SheetDoc } from '../../core/ir/sheet.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read a legacy `.xls` (BIFF8) workbook into a {@link SheetDoc} — the same IR
|
|
4
|
+
* tree the OOXML xlsx reader produces. Reads the workbook globals (sheet
|
|
5
|
+
* directory, shared strings, date system, styles, defined names, Escher BLIP
|
|
6
|
+
* store) and each worksheet substream's cells, styling and overlays.
|
|
7
|
+
*
|
|
8
|
+
* @param xls The `.xls` bytes (an OLE2/CFB container holding a `Workbook` stream).
|
|
9
|
+
* @returns The parsed spreadsheet IR tree.
|
|
10
|
+
* @throws Error on a non-OLE / non-BIFF8 input or a workbook with no worksheets
|
|
11
|
+
* (the reader's sniff keeps malformed inputs away); a structurally odd record
|
|
12
|
+
* is skipped, never fatal.
|
|
13
|
+
*/
|
|
2
14
|
export declare function readXlsToSheetDoc(xls: Uint8Array): SheetDoc;
|
|
15
|
+
/**
|
|
16
|
+
* §2.5.198.5 RkNumber — decode a packed 30-bit number: bit 0 means ÷100, bit 1
|
|
17
|
+
* selects integer vs. the 30 high bits of an IEEE double. Exported for unit tests
|
|
18
|
+
* (the int / ×100 / IEEE paths).
|
|
19
|
+
*/
|
|
3
20
|
export declare function decodeRk(rk: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* §2.4.265 SST — read the shared-string table: `cstTotal`/`cstUnique` then
|
|
23
|
+
* `cstUnique` rich strings, via a continuation-aware reader (a string can split
|
|
24
|
+
* across a CONTINUE boundary, and the byte after the boundary is a fresh
|
|
25
|
+
* `fHighByte` flag for the rest). Exported for unit tests of the continuation
|
|
26
|
+
* handling.
|
|
27
|
+
*
|
|
28
|
+
* @param blocks The SST record's data followed by each CONTINUE record's data.
|
|
29
|
+
* @returns The unique shared strings, in index order.
|
|
30
|
+
*/
|
|
4
31
|
export declare function readSst(blocks: ReadonlyArray<Uint8Array>): Array<string>;
|
|
@@ -57,6 +57,18 @@ var MAX_SHEETS = 4096;
|
|
|
57
57
|
var MAX_CELLS = 1 << 22;
|
|
58
58
|
var MAX_STRINGS = 1 << 21;
|
|
59
59
|
var MAX_ROW_HEIGHTS = 1 << 20;
|
|
60
|
+
/**
|
|
61
|
+
* Read a legacy `.xls` (BIFF8) workbook into a {@link SheetDoc} — the same IR
|
|
62
|
+
* tree the OOXML xlsx reader produces. Reads the workbook globals (sheet
|
|
63
|
+
* directory, shared strings, date system, styles, defined names, Escher BLIP
|
|
64
|
+
* store) and each worksheet substream's cells, styling and overlays.
|
|
65
|
+
*
|
|
66
|
+
* @param xls The `.xls` bytes (an OLE2/CFB container holding a `Workbook` stream).
|
|
67
|
+
* @returns The parsed spreadsheet IR tree.
|
|
68
|
+
* @throws Error on a non-OLE / non-BIFF8 input or a workbook with no worksheets
|
|
69
|
+
* (the reader's sniff keeps malformed inputs away); a structurally odd record
|
|
70
|
+
* is skipped, never fatal.
|
|
71
|
+
*/
|
|
60
72
|
function readXlsToSheetDoc(xls) {
|
|
61
73
|
const cfb = openCfb(xls);
|
|
62
74
|
const wb = cfb.readStream("Workbook") ?? cfb.readStream("Book");
|
|
@@ -1282,6 +1294,11 @@ function formulaCell(d, next) {
|
|
|
1282
1294
|
}
|
|
1283
1295
|
return numCell(row, col, style, String(readF64(d, 6)));
|
|
1284
1296
|
}
|
|
1297
|
+
/**
|
|
1298
|
+
* §2.5.198.5 RkNumber — decode a packed 30-bit number: bit 0 means ÷100, bit 1
|
|
1299
|
+
* selects integer vs. the 30 high bits of an IEEE double. Exported for unit tests
|
|
1300
|
+
* (the int / ×100 / IEEE paths).
|
|
1301
|
+
*/
|
|
1285
1302
|
function decodeRk(rk) {
|
|
1286
1303
|
const div100 = (rk & 1) !== 0;
|
|
1287
1304
|
let value;
|
|
@@ -1330,6 +1347,16 @@ function decodeChars(d, off, cch, highByte) {
|
|
|
1330
1347
|
else for (let i = 0; i < cch && off + i < d.length; i++) s += String.fromCharCode(d[off + i]);
|
|
1331
1348
|
return s;
|
|
1332
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* §2.4.265 SST — read the shared-string table: `cstTotal`/`cstUnique` then
|
|
1352
|
+
* `cstUnique` rich strings, via a continuation-aware reader (a string can split
|
|
1353
|
+
* across a CONTINUE boundary, and the byte after the boundary is a fresh
|
|
1354
|
+
* `fHighByte` flag for the rest). Exported for unit tests of the continuation
|
|
1355
|
+
* handling.
|
|
1356
|
+
*
|
|
1357
|
+
* @param blocks The SST record's data followed by each CONTINUE record's data.
|
|
1358
|
+
* @returns The unique shared strings, in index order.
|
|
1359
|
+
*/
|
|
1333
1360
|
function readSst(blocks) {
|
|
1334
1361
|
const r = new SstReader(blocks);
|
|
1335
1362
|
r.u32();
|
|
@@ -1338,33 +1365,45 @@ function readSst(blocks) {
|
|
|
1338
1365
|
for (let i = 0; i < cstUnique && !r.atEnd(); i++) out.push(r.readString());
|
|
1339
1366
|
return out;
|
|
1340
1367
|
}
|
|
1368
|
+
/**
|
|
1369
|
+
* A cursor over the SST's record blocks. Header/flag reads stay within a block
|
|
1370
|
+
* (the spec never splits them); only the character array crosses boundaries, and
|
|
1371
|
+
* each crossing re-reads the `fHighByte` flag.
|
|
1372
|
+
*/
|
|
1341
1373
|
var SstReader = class {
|
|
1342
1374
|
bi = 0;
|
|
1343
1375
|
off = 0;
|
|
1376
|
+
/** @param blocks The SST record's data followed by each CONTINUE record's data. */
|
|
1344
1377
|
constructor(blocks) {
|
|
1345
1378
|
this.blocks = blocks;
|
|
1346
1379
|
}
|
|
1380
|
+
/** Whether the cursor has consumed every block. */
|
|
1347
1381
|
atEnd() {
|
|
1348
1382
|
this.settle();
|
|
1349
1383
|
return this.bi >= this.blocks.length;
|
|
1350
1384
|
}
|
|
1385
|
+
/** Advance off the end of exhausted blocks (a "skip" crossing — no flag byte). */
|
|
1351
1386
|
settle() {
|
|
1352
1387
|
while (this.bi < this.blocks.length && this.off >= this.blocks[this.bi].length) {
|
|
1353
1388
|
this.bi++;
|
|
1354
1389
|
this.off = 0;
|
|
1355
1390
|
}
|
|
1356
1391
|
}
|
|
1392
|
+
/** Read one byte, advancing across exhausted blocks; 0 past the end. */
|
|
1357
1393
|
byte() {
|
|
1358
1394
|
this.settle();
|
|
1359
1395
|
if (this.bi >= this.blocks.length) return 0;
|
|
1360
1396
|
return this.blocks[this.bi][this.off++];
|
|
1361
1397
|
}
|
|
1398
|
+
/** Read a little-endian unsigned 16-bit integer. */
|
|
1362
1399
|
u16() {
|
|
1363
1400
|
return this.byte() | this.byte() << 8;
|
|
1364
1401
|
}
|
|
1402
|
+
/** Read a little-endian unsigned 32-bit integer. */
|
|
1365
1403
|
u32() {
|
|
1366
1404
|
return (this.u16() | this.u16() << 16) >>> 0;
|
|
1367
1405
|
}
|
|
1406
|
+
/** Skip `n` bytes (used for the rich-run + phonetic tails, which carry no flags). */
|
|
1368
1407
|
skip(n) {
|
|
1369
1408
|
let left = n;
|
|
1370
1409
|
while (left > 0) {
|
|
@@ -1375,6 +1414,11 @@ var SstReader = class {
|
|
|
1375
1414
|
left -= take;
|
|
1376
1415
|
}
|
|
1377
1416
|
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Read one XLUnicodeRichExtendedString: a 16-bit char count, a flags byte, the
|
|
1419
|
+
* optional rich-run / phonetic sizes, the (possibly continuation-split)
|
|
1420
|
+
* characters, then the skipped rich-run + phonetic tails.
|
|
1421
|
+
*/
|
|
1378
1422
|
readString() {
|
|
1379
1423
|
const cch = this.u16();
|
|
1380
1424
|
const flags = this.byte();
|
|
@@ -3,6 +3,26 @@ interface BiffRec {
|
|
|
3
3
|
readonly type: number;
|
|
4
4
|
readonly data: Uint8Array;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Build a palette-index → `"FFRRGGBB"` (8-hex ARGB, like the xlsx `rgb` attr)
|
|
8
|
+
* resolver from the default 56-colour palette plus any `PALETTE` override.
|
|
9
|
+
* `0x7FFF` / 64 / 65 are automatic or system colours → `undefined` (the renderer
|
|
10
|
+
* default). Exported so the conditional-format reader (XLS-13) resolves its dxf
|
|
11
|
+
* colours the same way.
|
|
12
|
+
*
|
|
13
|
+
* @param records The workbook-globals records (scanned for a `PALETTE` override).
|
|
14
|
+
* @returns A function mapping a colour index (icv) to its hex, or `undefined`.
|
|
15
|
+
*/
|
|
6
16
|
export declare function buildBiffPalette(records: ReadonlyArray<BiffRec>): (icv: number) => string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Read a `.xls` workbook globals' FONT / FORMAT / PALETTE / XF records (XLS-4)
|
|
19
|
+
* into the shared `XlsxStyles` model the OOXML path uses. BIFF packs each XF's
|
|
20
|
+
* fill and border inline and stores colours as palette indices; these are
|
|
21
|
+
* resolved through {@link buildBiffPalette} and de-duplicated into the model's
|
|
22
|
+
* shared fill/border arrays.
|
|
23
|
+
*
|
|
24
|
+
* @param records The workbook-globals record stream.
|
|
25
|
+
* @returns The style table (numFmts, fonts, fills, borders, cellXfs).
|
|
26
|
+
*/
|
|
7
27
|
export declare function parseBiffStyles(records: ReadonlyArray<BiffRec>): XlsxStyles;
|
|
8
28
|
export {};
|
|
@@ -115,6 +115,16 @@ var PALETTE56 = [
|
|
|
115
115
|
"333399",
|
|
116
116
|
"333333"
|
|
117
117
|
];
|
|
118
|
+
/**
|
|
119
|
+
* Build a palette-index → `"FFRRGGBB"` (8-hex ARGB, like the xlsx `rgb` attr)
|
|
120
|
+
* resolver from the default 56-colour palette plus any `PALETTE` override.
|
|
121
|
+
* `0x7FFF` / 64 / 65 are automatic or system colours → `undefined` (the renderer
|
|
122
|
+
* default). Exported so the conditional-format reader (XLS-13) resolves its dxf
|
|
123
|
+
* colours the same way.
|
|
124
|
+
*
|
|
125
|
+
* @param records The workbook-globals records (scanned for a `PALETTE` override).
|
|
126
|
+
* @returns A function mapping a colour index (icv) to its hex, or `undefined`.
|
|
127
|
+
*/
|
|
118
128
|
function buildBiffPalette(records) {
|
|
119
129
|
const palette = [...PALETTE56.slice(0, 8), ...PALETTE56];
|
|
120
130
|
for (const rec of records) if (rec.type === REC_PALETTE) applyPalette(rec.data, palette);
|
|
@@ -124,6 +134,16 @@ function buildBiffPalette(records) {
|
|
|
124
134
|
return rgb ? `FF${rgb}` : void 0;
|
|
125
135
|
};
|
|
126
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Read a `.xls` workbook globals' FONT / FORMAT / PALETTE / XF records (XLS-4)
|
|
139
|
+
* into the shared `XlsxStyles` model the OOXML path uses. BIFF packs each XF's
|
|
140
|
+
* fill and border inline and stores colours as palette indices; these are
|
|
141
|
+
* resolved through {@link buildBiffPalette} and de-duplicated into the model's
|
|
142
|
+
* shared fill/border arrays.
|
|
143
|
+
*
|
|
144
|
+
* @param records The workbook-globals record stream.
|
|
145
|
+
* @returns The style table (numFmts, fonts, fills, borders, cellXfs).
|
|
146
|
+
*/
|
|
127
147
|
function parseBiffStyles(records) {
|
|
128
148
|
const color = buildBiffPalette(records);
|
|
129
149
|
const fonts = [];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/** A picture shape: the BLIP store index it references plus its cell anchor. */
|
|
1
2
|
export interface EscherPicture {
|
|
3
|
+
/** 1-based index into the BLIP store (the OPT `pib` property). */
|
|
2
4
|
readonly blipIndex: number;
|
|
3
5
|
readonly anchor?: EscherAnchor;
|
|
4
6
|
}
|
|
7
|
+
/** A from/to two-cell anchor (each cell index a u16, each offset 1/1024 of the cell). */
|
|
5
8
|
export interface EscherAnchor {
|
|
6
9
|
readonly col1: number;
|
|
7
10
|
readonly row1: number;
|
|
@@ -12,13 +15,37 @@ export interface EscherAnchor {
|
|
|
12
15
|
readonly dx2: number;
|
|
13
16
|
readonly dy2: number;
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Read the workbook-globals MSODrawingGroup's BLIP store: one entry per BSE (so a
|
|
20
|
+
* `pib` index lines up), holding the extracted image bytes — or `undefined` for
|
|
21
|
+
* an entry we cannot read (a metafile blip, an empty slot), which keeps the
|
|
22
|
+
* indices aligned.
|
|
23
|
+
*
|
|
24
|
+
* @param msoDrawingGroup The concatenated MSODrawingGroup record bytes.
|
|
25
|
+
* @returns The image pool, indexed so `pib − 1` selects an entry.
|
|
26
|
+
*/
|
|
15
27
|
export declare function parseBlipStore(msoDrawingGroup: Uint8Array): Array<Uint8Array | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* The picture shapes in a sheet's MSODrawing: every SpContainer that carries a
|
|
30
|
+
* `pib` (a picture-fill reference into the BLIP store) with its cell anchor.
|
|
31
|
+
*/
|
|
16
32
|
export declare function parseSheetPictures(msoDrawing: Uint8Array): Array<EscherPicture>;
|
|
33
|
+
/**
|
|
34
|
+
* A non-picture drawing shape: its preset type (MSOSPT), cell anchor, fill/line
|
|
35
|
+
* colours (when literal RGB) and whether it carries a text box.
|
|
36
|
+
*/
|
|
17
37
|
export interface EscherShape {
|
|
38
|
+
/** The MSOSPT preset shape type (the Sp record's instance). */
|
|
18
39
|
readonly shapeType: number;
|
|
40
|
+
/** Whether the shape carries a client text box. */
|
|
19
41
|
readonly hasText: boolean;
|
|
20
42
|
readonly anchor?: EscherAnchor;
|
|
21
43
|
readonly fillColorHex?: string;
|
|
22
44
|
readonly lineColorHex?: string;
|
|
23
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The non-picture shapes (autoshapes, text boxes) in a sheet's MSODrawing — every
|
|
48
|
+
* SpContainer that is NOT a picture (no `pib`). Pictures are handled separately
|
|
49
|
+
* by {@link parseSheetPictures}.
|
|
50
|
+
*/
|
|
24
51
|
export declare function parseSheetShapes(msoDrawing: Uint8Array): Array<EscherShape>;
|
|
@@ -24,6 +24,15 @@ function* records(d) {
|
|
|
24
24
|
off = end;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Read the workbook-globals MSODrawingGroup's BLIP store: one entry per BSE (so a
|
|
29
|
+
* `pib` index lines up), holding the extracted image bytes — or `undefined` for
|
|
30
|
+
* an entry we cannot read (a metafile blip, an empty slot), which keeps the
|
|
31
|
+
* indices aligned.
|
|
32
|
+
*
|
|
33
|
+
* @param msoDrawingGroup The concatenated MSODrawingGroup record bytes.
|
|
34
|
+
* @returns The image pool, indexed so `pib − 1` selects an entry.
|
|
35
|
+
*/
|
|
27
36
|
function parseBlipStore(msoDrawingGroup) {
|
|
28
37
|
const store = findContainer(msoDrawingGroup, FBT_BSTORE_CONTAINER, 0);
|
|
29
38
|
if (!store) return [];
|
|
@@ -41,6 +50,10 @@ function findContainer(d, type, depth) {
|
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The picture shapes in a sheet's MSODrawing: every SpContainer that carries a
|
|
55
|
+
* `pib` (a picture-fill reference into the BLIP store) with its cell anchor.
|
|
56
|
+
*/
|
|
44
57
|
function parseSheetPictures(msoDrawing) {
|
|
45
58
|
const out = [];
|
|
46
59
|
collectPictures(msoDrawing, out, 0);
|
|
@@ -63,6 +76,11 @@ var FBT_SP = 61450;
|
|
|
63
76
|
var FBT_CLIENT_TEXTBOX = 61453;
|
|
64
77
|
var PROP_FILL_COLOR = 385;
|
|
65
78
|
var PROP_LINE_COLOR = 448;
|
|
79
|
+
/**
|
|
80
|
+
* The non-picture shapes (autoshapes, text boxes) in a sheet's MSODrawing — every
|
|
81
|
+
* SpContainer that is NOT a picture (no `pib`). Pictures are handled separately
|
|
82
|
+
* by {@link parseSheetPictures}.
|
|
83
|
+
*/
|
|
66
84
|
function parseSheetShapes(msoDrawing) {
|
|
67
85
|
const out = [];
|
|
68
86
|
collectShapes(msoDrawing, out, 0);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { DocumentReader } from '../../core/ir/adapters.js';
|
|
2
2
|
import { SheetDoc } from '../../core/ir/sheet.js';
|
|
3
|
+
/**
|
|
4
|
+
* The legacy `.xls` {@link DocumentReader} (XLS-3): sniffs a BIFF8 OLE2/CFB
|
|
5
|
+
* workbook and reads it into the same {@link SheetDoc} the OOXML xlsx reader
|
|
6
|
+
* produces, so the whole render pipeline works on a 1997–2003 `.xls`. Reports a
|
|
7
|
+
* single degraded {@link Loss} for the unread Excel-tables / autofilter feature.
|
|
8
|
+
*/
|
|
3
9
|
export declare const xlsReader: DocumentReader<SheetDoc>;
|
|
@@ -16,6 +16,12 @@ var XLS_LOSSES = [{
|
|
|
16
16
|
feature: FEATURES.cellFormatting,
|
|
17
17
|
detail: "legacy .xls Excel tables / autofilter are not read; the sheet’s cell data, styling, images, charts, drawing shapes, conditional formatting, comments, hyperlinks, data validation, defined names, the page-setup print model, frozen panes and custom row heights are"
|
|
18
18
|
}];
|
|
19
|
+
/**
|
|
20
|
+
* The legacy `.xls` {@link DocumentReader} (XLS-3): sniffs a BIFF8 OLE2/CFB
|
|
21
|
+
* workbook and reads it into the same {@link SheetDoc} the OOXML xlsx reader
|
|
22
|
+
* produces, so the whole render pipeline works on a 1997–2003 `.xls`. Reports a
|
|
23
|
+
* single degraded {@link Loss} for the unread Excel-tables / autofilter feature.
|
|
24
|
+
*/
|
|
19
25
|
var xlsReader = {
|
|
20
26
|
id: "xls",
|
|
21
27
|
produces: "sheet",
|
|
@@ -2,6 +2,32 @@ import { DocumentReader, ReadResult } from '../core/ir/adapters.js';
|
|
|
2
2
|
import { FlowDoc } from '../core/ir/flow.js';
|
|
3
3
|
import { SheetDoc } from '../core/ir/sheet.js';
|
|
4
4
|
import { ProjectSheetOptions } from './sheet-to-flow.js';
|
|
5
|
+
/**
|
|
6
|
+
* Read a `.xlsx` and project it to a {@link FlowDoc} in one step:
|
|
7
|
+
* {@link readXlsxToSheetDoc} then {@link projectSheetDoc}. The xlsx reader
|
|
8
|
+
* records no read-time losses.
|
|
9
|
+
*
|
|
10
|
+
* @param xlsx The `.xlsx` (OPC ZIP) bytes.
|
|
11
|
+
* @param options Projection knobs (the W9 reference date).
|
|
12
|
+
* @returns The flow document plus an (empty) loss list.
|
|
13
|
+
*/
|
|
5
14
|
export declare function readXlsx(xlsx: Uint8Array, options?: ProjectSheetOptions): ReadResult<FlowDoc>;
|
|
15
|
+
/**
|
|
16
|
+
* Read a `.xlsx` into the {@link SheetDoc} SpreadsheetML IR node. Everything that
|
|
17
|
+
* needs the OPC package — workbook/worksheet/styles/shared-string parsing, chart
|
|
18
|
+
* and drawing resolution, tables, pivots, slicers, hyperlinks, comments and
|
|
19
|
+
* controls — happens here; the SheetDoc → FlowDoc projection (sheet-to-flow) is
|
|
20
|
+
* then a pure transform.
|
|
21
|
+
*
|
|
22
|
+
* @param xlsx The `.xlsx` (OPC ZIP) bytes.
|
|
23
|
+
* @returns The parsed spreadsheet IR tree.
|
|
24
|
+
* @throws Error when `xl/workbook.xml` is missing or the workbook has no sheets.
|
|
25
|
+
*/
|
|
6
26
|
export declare function readXlsxToSheetDoc(xlsx: Uint8Array): SheetDoc;
|
|
27
|
+
/**
|
|
28
|
+
* The OOXML `.xlsx` {@link DocumentReader}: sniffs the OPC ZIP for
|
|
29
|
+
* `xl/workbook.xml` and reads it into a {@link SheetDoc}. The reader's native
|
|
30
|
+
* tree is the SheetDoc; the facade/Ream project it to a {@link FlowDoc} for
|
|
31
|
+
* rendering (E-SHEET SB1).
|
|
32
|
+
*/
|
|
7
33
|
export declare const xlsxReader: DocumentReader<SheetDoc>;
|
|
@@ -34,12 +34,32 @@ var SLICER_CACHE_REL_TAIL = "/slicerCache";
|
|
|
34
34
|
var THREADED_COMMENTS_REL_TAIL = "/threadedComment";
|
|
35
35
|
var PERSON_REL_TAIL = "/person";
|
|
36
36
|
var MAX_SLICER_ITEMS = 256;
|
|
37
|
+
/**
|
|
38
|
+
* Read a `.xlsx` and project it to a {@link FlowDoc} in one step:
|
|
39
|
+
* {@link readXlsxToSheetDoc} then {@link projectSheetDoc}. The xlsx reader
|
|
40
|
+
* records no read-time losses.
|
|
41
|
+
*
|
|
42
|
+
* @param xlsx The `.xlsx` (OPC ZIP) bytes.
|
|
43
|
+
* @param options Projection knobs (the W9 reference date).
|
|
44
|
+
* @returns The flow document plus an (empty) loss list.
|
|
45
|
+
*/
|
|
37
46
|
function readXlsx(xlsx, options = {}) {
|
|
38
47
|
return {
|
|
39
48
|
doc: projectSheetDoc(readXlsxToSheetDoc(xlsx), options),
|
|
40
49
|
losses: []
|
|
41
50
|
};
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Read a `.xlsx` into the {@link SheetDoc} SpreadsheetML IR node. Everything that
|
|
54
|
+
* needs the OPC package — workbook/worksheet/styles/shared-string parsing, chart
|
|
55
|
+
* and drawing resolution, tables, pivots, slicers, hyperlinks, comments and
|
|
56
|
+
* controls — happens here; the SheetDoc → FlowDoc projection (sheet-to-flow) is
|
|
57
|
+
* then a pure transform.
|
|
58
|
+
*
|
|
59
|
+
* @param xlsx The `.xlsx` (OPC ZIP) bytes.
|
|
60
|
+
* @returns The parsed spreadsheet IR tree.
|
|
61
|
+
* @throws Error when `xl/workbook.xml` is missing or the workbook has no sheets.
|
|
62
|
+
*/
|
|
43
63
|
function readXlsxToSheetDoc(xlsx) {
|
|
44
64
|
const pkg = OpcPackage.open(xlsx);
|
|
45
65
|
const workbookData = pkg.getPart(WORKBOOK_PART);
|
|
@@ -384,6 +404,12 @@ function lighten(hex, amount) {
|
|
|
384
404
|
const hx = (c) => c.toString(16).padStart(2, "0").toUpperCase();
|
|
385
405
|
return `${hx(ch(16))}${hx(ch(8))}${hx(ch(0))}`;
|
|
386
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* The OOXML `.xlsx` {@link DocumentReader}: sniffs the OPC ZIP for
|
|
409
|
+
* `xl/workbook.xml` and reads it into a {@link SheetDoc}. The reader's native
|
|
410
|
+
* tree is the SheetDoc; the facade/Ream project it to a {@link FlowDoc} for
|
|
411
|
+
* rendering (E-SHEET SB1).
|
|
412
|
+
*/
|
|
387
413
|
var xlsxReader = {
|
|
388
414
|
id: "xlsx",
|
|
389
415
|
produces: "sheet",
|
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
import { FontBytesByVariant } from '../core/font/index.js';
|
|
2
2
|
import { FetchLike } from '../core/fonts/index.js';
|
|
3
3
|
import { SignatureOptions, StyledRenderOptions } from '../pdf/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the xlsx → PDF convenience converters. Extends the low-level
|
|
6
|
+
* {@link StyledRenderOptions} (minus the font `registry` and `styles`, which the
|
|
7
|
+
* converter builds itself) with font acquisition and source-touching conveniences.
|
|
8
|
+
*/
|
|
4
9
|
export interface ConvertXlsxOptions extends Omit<StyledRenderOptions, 'registry' | 'styles'> {
|
|
10
|
+
/** Shorthand for supplying a single regular-variant font as raw bytes. */
|
|
5
11
|
readonly fontBytes?: Uint8Array;
|
|
12
|
+
/** Explicit font bytes per variant (regular/bold/italic/bold-italic). */
|
|
6
13
|
readonly fonts?: FontBytesByVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Force a substitute font family for the auto-download path. Ignored when
|
|
16
|
+
* `fonts`/`fontBytes` are supplied.
|
|
17
|
+
*/
|
|
7
18
|
readonly fontFamily?: string;
|
|
19
|
+
/** Injectable `fetch` for the auto-download path (defaults to the global `fetch`). */
|
|
8
20
|
readonly fontFetch?: FetchLike;
|
|
21
|
+
/**
|
|
22
|
+
* For PDF/A-3 only: embed the input `.xlsx` as an associated source file
|
|
23
|
+
* (`/AFRelationship /Source`). Ignored for other profiles.
|
|
24
|
+
*/
|
|
9
25
|
readonly embedSource?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* E-SHEET W9 — the reference date for conditional-format `timePeriod` rules and
|
|
28
|
+
* `TODAY()`/`NOW()` in `expression` rules. An explicit input (never the wall
|
|
29
|
+
* clock), so output stays deterministic; omitted ⇒ those clock-relative rules
|
|
30
|
+
* no-op.
|
|
31
|
+
*/
|
|
10
32
|
readonly now?: Date;
|
|
33
|
+
/**
|
|
34
|
+
* Digitally sign the output (ISO 32000 §12.8). Requires the async
|
|
35
|
+
* {@link convertXlsxToPdf} (signing uses WebCrypto). Ignored by the sync
|
|
36
|
+
* converter.
|
|
37
|
+
*/
|
|
11
38
|
readonly signature?: SignatureOptions;
|
|
12
39
|
}
|
|
13
40
|
/**
|