@rowsncolumns/toolkit 24.4.1 → 24.4.3

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.
Files changed (131) hide show
  1. package/dist/cjs/excel-parser/cfb-decryptor.d.ts +6 -0
  2. package/dist/cjs/excel-parser/cfb-decryptor.d.ts.map +1 -1
  3. package/dist/cjs/excel-parser/cfb-decryptor.js +6 -0
  4. package/dist/cjs/excel-parser/helpers.d.ts +9 -1
  5. package/dist/cjs/excel-parser/helpers.d.ts.map +1 -1
  6. package/dist/cjs/excel-parser/helpers.js +37 -0
  7. package/dist/cjs/excel-parser/interface.d.ts +10 -1
  8. package/dist/cjs/excel-parser/interface.d.ts.map +1 -1
  9. package/dist/cjs/excel-parser/plugins/ods/index.d.ts +19 -0
  10. package/dist/cjs/excel-parser/plugins/ods/index.d.ts.map +1 -1
  11. package/dist/cjs/excel-parser/plugins/ods/index.js +676 -304
  12. package/dist/cjs/excel-parser/plugins/ods/styles.d.ts +43 -1
  13. package/dist/cjs/excel-parser/plugins/ods/styles.d.ts.map +1 -1
  14. package/dist/cjs/excel-parser/plugins/ods/styles.js +343 -45
  15. package/dist/cjs/excel-parser/plugins/xls/index.d.ts +11 -3
  16. package/dist/cjs/excel-parser/plugins/xls/index.d.ts.map +1 -1
  17. package/dist/cjs/excel-parser/plugins/xls/index.js +55 -6
  18. package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts +4 -0
  19. package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
  20. package/dist/cjs/excel-parser/plugins/xlsb/index.js +21 -9
  21. package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts +10 -0
  22. package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
  23. package/dist/cjs/excel-parser/plugins/xlsx/charts.js +68 -9
  24. package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
  25. package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
  26. package/dist/cjs/excel-parser/plugins/xlsx/drawing.js +155 -20
  27. package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts +26 -1
  28. package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
  29. package/dist/cjs/excel-parser/plugins/xlsx/index.js +567 -234
  30. package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
  31. package/dist/cjs/excel-parser/plugins/xlsx/pivots.js +125 -37
  32. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
  33. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
  34. package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.js +4 -1
  35. package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
  36. package/dist/cjs/excel-parser/plugins/xlsx/styles.js +12 -2
  37. package/dist/cjs/excel-parser/registry.d.ts.map +1 -1
  38. package/dist/cjs/excel-parser/registry.js +2 -0
  39. package/dist/cjs/excel-parser/types.d.ts +7 -1
  40. package/dist/cjs/excel-parser/types.d.ts.map +1 -1
  41. package/dist/cjs/excel-parser/workbook.d.ts +1 -0
  42. package/dist/cjs/excel-parser/workbook.d.ts.map +1 -1
  43. package/dist/cjs/excel-parser/workbook.js +4 -0
  44. package/dist/cjs/excel-parser/worker.js +3 -1
  45. package/dist/cjs/exporter/ods/ods-export.d.ts.map +1 -1
  46. package/dist/cjs/exporter/ods/ods-export.js +432 -175
  47. package/dist/cjs/exporter/xlsx/chart-builder.d.ts.map +1 -1
  48. package/dist/cjs/exporter/xlsx/chart-builder.js +210 -6
  49. package/dist/cjs/exporter/xlsx/pivot-builder.d.ts +8 -0
  50. package/dist/cjs/exporter/xlsx/pivot-builder.d.ts.map +1 -1
  51. package/dist/cjs/exporter/xlsx/pivot-builder.js +141 -42
  52. package/dist/cjs/exporter/xlsx/style-builder.js +9 -3
  53. package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
  54. package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
  55. package/dist/cjs/exporter/xlsx/threaded-comments-builder.js +15 -3
  56. package/dist/cjs/exporter/xlsx/xlsx-export.d.ts +11 -2
  57. package/dist/cjs/exporter/xlsx/xlsx-export.d.ts.map +1 -1
  58. package/dist/cjs/exporter/xlsx/xlsx-export.js +678 -222
  59. package/dist/cjs/helpers/implicit-intersection.d.ts +16 -0
  60. package/dist/cjs/helpers/implicit-intersection.d.ts.map +1 -0
  61. package/dist/cjs/helpers/implicit-intersection.js +197 -0
  62. package/dist/cjs/print-settings.d.ts +105 -0
  63. package/dist/cjs/print-settings.d.ts.map +1 -0
  64. package/dist/cjs/print-settings.js +494 -0
  65. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  66. package/dist/esm/excel-parser/cfb-decryptor.d.ts +6 -0
  67. package/dist/esm/excel-parser/cfb-decryptor.d.ts.map +1 -1
  68. package/dist/esm/excel-parser/cfb-decryptor.js +6 -0
  69. package/dist/esm/excel-parser/helpers.d.ts +9 -1
  70. package/dist/esm/excel-parser/helpers.d.ts.map +1 -1
  71. package/dist/esm/excel-parser/helpers.js +34 -0
  72. package/dist/esm/excel-parser/interface.d.ts +10 -1
  73. package/dist/esm/excel-parser/interface.d.ts.map +1 -1
  74. package/dist/esm/excel-parser/plugins/ods/index.d.ts +19 -0
  75. package/dist/esm/excel-parser/plugins/ods/index.d.ts.map +1 -1
  76. package/dist/esm/excel-parser/plugins/ods/index.js +347 -33
  77. package/dist/esm/excel-parser/plugins/ods/styles.d.ts +43 -1
  78. package/dist/esm/excel-parser/plugins/ods/styles.d.ts.map +1 -1
  79. package/dist/esm/excel-parser/plugins/ods/styles.js +276 -2
  80. package/dist/esm/excel-parser/plugins/xls/index.d.ts +11 -3
  81. package/dist/esm/excel-parser/plugins/xls/index.d.ts.map +1 -1
  82. package/dist/esm/excel-parser/plugins/xls/index.js +37 -5
  83. package/dist/esm/excel-parser/plugins/xlsb/index.d.ts +4 -0
  84. package/dist/esm/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
  85. package/dist/esm/excel-parser/plugins/xlsb/index.js +20 -6
  86. package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts +10 -0
  87. package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
  88. package/dist/esm/excel-parser/plugins/xlsx/charts.js +69 -6
  89. package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
  90. package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
  91. package/dist/esm/excel-parser/plugins/xlsx/drawing.js +99 -0
  92. package/dist/esm/excel-parser/plugins/xlsx/index.d.ts +26 -1
  93. package/dist/esm/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
  94. package/dist/esm/excel-parser/plugins/xlsx/index.js +362 -26
  95. package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
  96. package/dist/esm/excel-parser/plugins/xlsx/pivots.js +86 -6
  97. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
  98. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
  99. package/dist/esm/excel-parser/plugins/xlsx/sheet-views.js +2 -0
  100. package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
  101. package/dist/esm/excel-parser/plugins/xlsx/styles.js +12 -2
  102. package/dist/esm/excel-parser/registry.d.ts.map +1 -1
  103. package/dist/esm/excel-parser/registry.js +2 -0
  104. package/dist/esm/excel-parser/types.d.ts +7 -1
  105. package/dist/esm/excel-parser/types.d.ts.map +1 -1
  106. package/dist/esm/excel-parser/workbook.d.ts +1 -0
  107. package/dist/esm/excel-parser/workbook.d.ts.map +1 -1
  108. package/dist/esm/excel-parser/workbook.js +3 -0
  109. package/dist/esm/excel-parser/worker.js +2 -0
  110. package/dist/esm/exporter/ods/ods-export.d.ts.map +1 -1
  111. package/dist/esm/exporter/ods/ods-export.js +306 -35
  112. package/dist/esm/exporter/xlsx/chart-builder.d.ts.map +1 -1
  113. package/dist/esm/exporter/xlsx/chart-builder.js +161 -0
  114. package/dist/esm/exporter/xlsx/pivot-builder.d.ts +8 -0
  115. package/dist/esm/exporter/xlsx/pivot-builder.d.ts.map +1 -1
  116. package/dist/esm/exporter/xlsx/pivot-builder.js +104 -19
  117. package/dist/esm/exporter/xlsx/style-builder.js +9 -3
  118. package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
  119. package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
  120. package/dist/esm/exporter/xlsx/threaded-comments-builder.js +15 -3
  121. package/dist/esm/exporter/xlsx/xlsx-export.d.ts +11 -2
  122. package/dist/esm/exporter/xlsx/xlsx-export.d.ts.map +1 -1
  123. package/dist/esm/exporter/xlsx/xlsx-export.js +449 -47
  124. package/dist/esm/helpers/implicit-intersection.d.ts +16 -0
  125. package/dist/esm/helpers/implicit-intersection.d.ts.map +1 -0
  126. package/dist/esm/helpers/implicit-intersection.js +184 -0
  127. package/dist/esm/print-settings.d.ts +105 -0
  128. package/dist/esm/print-settings.d.ts.map +1 -0
  129. package/dist/esm/print-settings.js +422 -0
  130. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  131. package/package.json +3 -3
@@ -1,13 +1,32 @@
1
- import type { CellFormat, Color, TextFormat } from "@rowsncolumns/spreadsheet";
1
+ import type { CellFormat, Color, PageMargins, PageSetup, PrintOptions, TextFormat } from "@rowsncolumns/spreadsheet";
2
2
  type OdsRowStyle = {
3
3
  height?: number;
4
4
  hidden?: boolean;
5
5
  format?: CellFormat;
6
+ /** `fo:break-before="page"` — a manual page break above this row. */
7
+ breakBefore?: boolean;
6
8
  };
7
9
  type OdsColumnStyle = {
8
10
  width?: number;
9
11
  hidden?: boolean;
10
12
  format?: CellFormat;
13
+ /** `fo:break-before="page"` — a manual page break left of this column. */
14
+ breakBefore?: boolean;
15
+ };
16
+ /**
17
+ * `<style:page-layout>` mapped onto the sheet print facets. Margins are
18
+ * inches; `fo:page-width/height` resolve to the nearest ECMA paper-size code.
19
+ */
20
+ export type OdsPageLayout = {
21
+ pageSetup?: PageSetup;
22
+ pageMargins?: PageMargins;
23
+ printOptions?: PrintOptions;
24
+ };
25
+ /** `<style:master-page>`: its page layout plus header/footer as Excel codes. */
26
+ export type OdsMasterPage = {
27
+ pageLayoutName?: string;
28
+ header?: string;
29
+ footer?: string;
11
30
  };
12
31
  export declare class OdsStyles {
13
32
  private cellStyles;
@@ -22,9 +41,28 @@ export declare class OdsStyles {
22
41
  private automaticTableStyles;
23
42
  private numberFormats;
24
43
  private chartStyles;
44
+ /** Table style name → `style:master-page-name`. */
45
+ private tableMasterPages;
46
+ private pageLayouts;
47
+ private masterPages;
48
+ /** `style:family="table"` styles whose `style:table-properties` carry a right-to-left `style:writing-mode`. */
49
+ private rightToLeftTableStyles;
50
+ /** Chart styles whose `style:chart-properties` carry `chart:three-dimensional="true"`. */
51
+ private threeDimensionalChartStyles;
25
52
  constructor();
26
53
  reset(): void;
27
54
  parseStylesXml(stylesXml: any): void;
55
+ /**
56
+ * `<office:master-styles><style:master-page>` from the ORDER-PRESERVING
57
+ * parse of styles.xml — header/footer paragraphs are mixed content
58
+ * (`Page <text:page-number/> of <text:page-count/>`), which the unordered
59
+ * tree cannot represent.
60
+ */
61
+ parseMasterPagesOrdered(stylesOrdered: any): void;
62
+ private processPageLayouts;
63
+ getTableMasterPageName(styleName: string): string | undefined;
64
+ getMasterPage(name: string): OdsMasterPage | undefined;
65
+ getPageLayout(name: string): OdsPageLayout | undefined;
28
66
  parseContentXml(contentXml: any): void;
29
67
  private processStyles;
30
68
  private processNumberStyles;
@@ -33,6 +71,10 @@ export declare class OdsStyles {
33
71
  getRowStyle(styleName: string): OdsRowStyle | undefined;
34
72
  getColumnStyle(styleName: string): OdsColumnStyle | undefined;
35
73
  getChartStyleColor(styleName?: string): Color | undefined;
74
+ /** Whether a chart style (plot-area) declares `chart:three-dimensional="true"`. */
75
+ isChartStyleThreeDimensional(styleName?: string): boolean;
76
+ /** Whether a `style:family="table"` style renders the sheet right-to-left. */
77
+ isTableStyleRightToLeft(styleName?: string): boolean;
36
78
  getTableCellFormat(styleName: string): CellFormat | undefined;
37
79
  getTextFormat(styleName?: string): TextFormat | undefined;
38
80
  private convertToCellFormat;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/ods/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,UAAU,EACV,KAAK,EAGL,UAAU,EACX,MAAM,2BAA2B,CAAC;AAGnC,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,mBAAmB,CAA+B;IAC1D,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,YAAY,CAA0C;IAC9D,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,UAAU,CAAkD;IACpE,OAAO,CAAC,mBAAmB,CAAkD;IAC7E,OAAO,CAAC,WAAW,CAAkD;IACrE,OAAO,CAAC,oBAAoB,CAAkD;IAC9E,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,WAAW,CAAiC;;IAIpD,KAAK;IAeL,cAAc,CAAC,SAAS,EAAE,GAAG;IAsB7B,eAAe,CAAC,UAAU,EAAE,GAAG;IAc/B,OAAO,CAAC,aAAa;IA4FrB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,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1B,OAAO,CAAC,oBAAoB;IA+D5B,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,qBAAqB;CAgB9B"}
@@ -1,4 +1,5 @@
1
1
  import { get } from "lodash-es";
2
+ import { headerFooterZoneFromTokens, joinHeaderFooterZones, odsLengthToInches, paperSizeFromCm, parseOdsPrintTokens, parseOdsTableCentering, } from "../../../print-settings";
2
3
  export class OdsStyles {
3
4
  cellStyles = new Map();
4
5
  automaticCellStyles = new Map();
@@ -12,6 +13,14 @@ export class OdsStyles {
12
13
  automaticTableStyles = new Map();
13
14
  numberFormats = new Map();
14
15
  chartStyles = new Map();
16
+ /** Table style name → `style:master-page-name`. */
17
+ tableMasterPages = new Map();
18
+ pageLayouts = new Map();
19
+ masterPages = new Map();
20
+ /** `style:family="table"` styles whose `style:table-properties` carry a right-to-left `style:writing-mode`. */
21
+ rightToLeftTableStyles = new Set();
22
+ /** Chart styles whose `style:chart-properties` carry `chart:three-dimensional="true"`. */
23
+ threeDimensionalChartStyles = new Set();
15
24
  constructor() { }
16
25
  reset() {
17
26
  this.cellStyles.clear();
@@ -26,6 +35,11 @@ export class OdsStyles {
26
35
  this.automaticTableStyles.clear();
27
36
  this.numberFormats.clear();
28
37
  this.chartStyles.clear();
38
+ this.tableMasterPages.clear();
39
+ this.pageLayouts.clear();
40
+ this.masterPages.clear();
41
+ this.rightToLeftTableStyles.clear();
42
+ this.threeDimensionalChartStyles.clear();
29
43
  }
30
44
  parseStylesXml(stylesXml) {
31
45
  if (!stylesXml)
@@ -42,6 +56,138 @@ export class OdsStyles {
42
56
  this.processStyles(automaticStyles, false);
43
57
  this.processNumberStyles(documentStyles, get(documentStyles, "office:styles") || get(documentStyles, "styles"), get(documentStyles, "office:automatic-styles") ||
44
58
  get(documentStyles, "automatic-styles"));
59
+ this.processPageLayouts(get(documentStyles, "office:automatic-styles.style:page-layout") ||
60
+ get(documentStyles, "automatic-styles.page-layout"));
61
+ }
62
+ /**
63
+ * `<office:master-styles><style:master-page>` from the ORDER-PRESERVING
64
+ * parse of styles.xml — header/footer paragraphs are mixed content
65
+ * (`Page <text:page-number/> of <text:page-count/>`), which the unordered
66
+ * tree cannot represent.
67
+ */
68
+ parseMasterPagesOrdered(stylesOrdered) {
69
+ const documentStyles = orderedChildren(stylesOrdered, "office:document-styles") ||
70
+ orderedChildren(stylesOrdered, "document-styles");
71
+ const masterStyles = orderedChildren(documentStyles, "office:master-styles") ||
72
+ orderedChildren(documentStyles, "master-styles");
73
+ if (!Array.isArray(masterStyles))
74
+ return;
75
+ for (const node of masterStyles) {
76
+ const children = node["style:master-page"] || node["master-page"];
77
+ if (!children)
78
+ continue;
79
+ const attrs = node[":@"] || {};
80
+ const name = attrs["@_style:name"] || attrs["@_name"];
81
+ if (!name)
82
+ continue;
83
+ const header = odsHeaderFooterToCode(orderedChildren(children, "style:header") ||
84
+ orderedChildren(children, "header"));
85
+ const footer = odsHeaderFooterToCode(orderedChildren(children, "style:footer") ||
86
+ orderedChildren(children, "footer"));
87
+ this.masterPages.set(name, {
88
+ pageLayoutName: attrs["@_style:page-layout-name"] || attrs["@_page-layout-name"],
89
+ header,
90
+ footer,
91
+ });
92
+ }
93
+ }
94
+ processPageLayouts(layouts) {
95
+ if (!layouts)
96
+ return;
97
+ for (const layout of Array.isArray(layouts) ? layouts : [layouts]) {
98
+ const name = layout["@_style:name"] || layout["@_name"];
99
+ if (!name)
100
+ continue;
101
+ const props = this.getAttributes(layout["style:page-layout-properties"] ||
102
+ layout["page-layout-properties"]) || {};
103
+ const headerProps = this.getAttributes(get(layout, "style:header-style.style:header-footer-properties") ||
104
+ get(layout, "header-style.header-footer-properties"));
105
+ const footerProps = this.getAttributes(get(layout, "style:footer-style.style:header-footer-properties") ||
106
+ get(layout, "footer-style.header-footer-properties"));
107
+ const pageSetup = {};
108
+ const orientation = props["@_style:print-orientation"];
109
+ if (orientation === "landscape" || orientation === "portrait") {
110
+ pageSetup.orientation = orientation;
111
+ }
112
+ const widthIn = odsLengthToInches(props["@_fo:page-width"]);
113
+ const heightIn = odsLengthToInches(props["@_fo:page-height"]);
114
+ if (widthIn !== undefined && heightIn !== undefined) {
115
+ const code = paperSizeFromCm(widthIn * 2.54, heightIn * 2.54);
116
+ if (code !== undefined)
117
+ pageSetup.paperSize = code;
118
+ }
119
+ const scale = parseFloat(String(props["@_style:scale-to"] ?? ""));
120
+ if (Number.isFinite(scale) && scale > 0) {
121
+ pageSetup.scale = Math.round(scale);
122
+ }
123
+ const scaleToX = parseInt(props["@_loext:scale-to-X"] ?? "", 10);
124
+ const scaleToY = parseInt(props["@_loext:scale-to-Y"] ?? "", 10);
125
+ const scaleToPages = parseInt(props["@_style:scale-to-pages"] ?? "", 10);
126
+ if (Number.isFinite(scaleToX) || Number.isFinite(scaleToY)) {
127
+ pageSetup.fitToPage = true;
128
+ pageSetup.fitToWidth = Number.isFinite(scaleToX) ? scaleToX : 0;
129
+ pageSetup.fitToHeight = Number.isFinite(scaleToY) ? scaleToY : 0;
130
+ }
131
+ else if (Number.isFinite(scaleToPages)) {
132
+ // ODF's single "total pages" knob: 1 page ≡ Excel's 1×1 fit.
133
+ pageSetup.fitToPage = true;
134
+ pageSetup.fitToWidth = scaleToPages;
135
+ pageSetup.fitToHeight = scaleToPages === 1 ? 1 : 0;
136
+ }
137
+ const pageOrder = props["@_style:print-page-order"];
138
+ if (pageOrder === "ltr")
139
+ pageSetup.pageOrder = "overThenDown";
140
+ const firstPage = parseInt(props["@_style:first-page-number"] ?? "", 10);
141
+ if (Number.isFinite(firstPage) && firstPage > 0) {
142
+ pageSetup.firstPageNumber = firstPage;
143
+ pageSetup.useFirstPageNumber = true;
144
+ }
145
+ // ODF: header sits inside `fo:margin-top`; Excel: `header` is the edge
146
+ // → header distance and `top` the edge → body distance.
147
+ const marginTop = odsLengthToInches(props["@_fo:margin-top"]);
148
+ const marginBottom = odsLengthToInches(props["@_fo:margin-bottom"]);
149
+ const headerHeight = (odsLengthToInches(headerProps?.["@_fo:min-height"]) ?? 0) +
150
+ (odsLengthToInches(headerProps?.["@_fo:margin-bottom"]) ?? 0);
151
+ const footerHeight = (odsLengthToInches(footerProps?.["@_fo:min-height"]) ?? 0) +
152
+ (odsLengthToInches(footerProps?.["@_fo:margin-top"]) ?? 0);
153
+ const pageMargins = {};
154
+ const left = odsLengthToInches(props["@_fo:margin-left"]);
155
+ const right = odsLengthToInches(props["@_fo:margin-right"]);
156
+ if (left !== undefined)
157
+ pageMargins.left = roundInches(left);
158
+ if (right !== undefined)
159
+ pageMargins.right = roundInches(right);
160
+ if (marginTop !== undefined) {
161
+ pageMargins.header = roundInches(marginTop);
162
+ pageMargins.top = roundInches(marginTop + headerHeight);
163
+ }
164
+ if (marginBottom !== undefined) {
165
+ pageMargins.footer = roundInches(marginBottom);
166
+ pageMargins.bottom = roundInches(marginBottom + footerHeight);
167
+ }
168
+ const printOptions = {
169
+ ...parseOdsPrintTokens(props["@_style:print"]),
170
+ ...parseOdsTableCentering(props["@_style:table-centering"]),
171
+ };
172
+ const layoutEntry = {};
173
+ if (Object.keys(pageSetup).length)
174
+ layoutEntry.pageSetup = pageSetup;
175
+ if (Object.keys(pageMargins).length)
176
+ layoutEntry.pageMargins = pageMargins;
177
+ if (Object.keys(printOptions).length) {
178
+ layoutEntry.printOptions = printOptions;
179
+ }
180
+ this.pageLayouts.set(name, layoutEntry);
181
+ }
182
+ }
183
+ getTableMasterPageName(styleName) {
184
+ return this.tableMasterPages.get(styleName);
185
+ }
186
+ getMasterPage(name) {
187
+ return this.masterPages.get(name);
188
+ }
189
+ getPageLayout(name) {
190
+ return this.pageLayouts.get(name);
45
191
  }
46
192
  parseContentXml(contentXml) {
47
193
  if (!contentXml)
@@ -76,6 +222,19 @@ export class OdsStyles {
76
222
  continue;
77
223
  }
78
224
  if (family === "table") {
225
+ const masterPageName = style["@_style:master-page-name"] || style["@_master-page-name"];
226
+ if (masterPageName) {
227
+ this.tableMasterPages.set(name, masterPageName);
228
+ }
229
+ // ODF has no per-sheet flag for right-to-left display; it is the
230
+ // table style's `style:writing-mode` (`rl-tb` / `rl`), the
231
+ // counterpart of OOXML `<sheetView rightToLeft="1">`.
232
+ const tableProps = this.getAttributes(style["style:table-properties"] || style["table-properties"]);
233
+ const writingMode = tableProps?.["@_style:writing-mode"] ?? tableProps?.["@_writing-mode"];
234
+ if (typeof writingMode === "string" &&
235
+ /^(rl|rl-tb|tb-rl)$/.test(writingMode)) {
236
+ this.rightToLeftTableStyles.add(name);
237
+ }
79
238
  const format = this.normalizeCellFormat(this.convertToCellFormat(style));
80
239
  if (format) {
81
240
  (isAutomatic ? this.automaticTableStyles : this.tableStyles).set(name, format);
@@ -104,6 +263,12 @@ export class OdsStyles {
104
263
  }
105
264
  if (typeof family === "string" &&
106
265
  (family.startsWith("chart") || family === "graphic")) {
266
+ const chartProps = this.getAttributes(style["style:chart-properties"] || style["chart:chart-properties"]);
267
+ const threeDimensional = chartProps?.["@_chart:three-dimensional"] ??
268
+ chartProps?.["@_three-dimensional"];
269
+ if (threeDimensional === "true" || threeDimensional === true) {
270
+ this.threeDimensionalChartStyles.add(name);
271
+ }
107
272
  const color = this.convertChartStyle(style);
108
273
  if (color) {
109
274
  const displayName = style["@_style:display-name"] || style["@_display-name"];
@@ -174,6 +339,14 @@ export class OdsStyles {
174
339
  return undefined;
175
340
  return this.chartStyles.get(styleName);
176
341
  }
342
+ /** Whether a chart style (plot-area) declares `chart:three-dimensional="true"`. */
343
+ isChartStyleThreeDimensional(styleName) {
344
+ return !!styleName && this.threeDimensionalChartStyles.has(styleName);
345
+ }
346
+ /** Whether a `style:family="table"` style renders the sheet right-to-left. */
347
+ isTableStyleRightToLeft(styleName) {
348
+ return !!styleName && this.rightToLeftTableStyles.has(styleName);
349
+ }
177
350
  getTableCellFormat(styleName) {
178
351
  return (this.automaticTableStyles.get(styleName) ||
179
352
  this.tableStyles.get(styleName));
@@ -411,14 +584,16 @@ export class OdsStyles {
411
584
  const hidden = visibility === "collapse" ||
412
585
  visibility === "hidden" ||
413
586
  visibility === "none";
587
+ const breakBefore = rowProps?.["@_fo:break-before"] === "page";
414
588
  const format = this.normalizeCellFormat(this.convertToCellFormat(style));
415
- if (height === undefined && !hidden && !format) {
589
+ if (height === undefined && !hidden && !format && !breakBefore) {
416
590
  return undefined;
417
591
  }
418
592
  return {
419
593
  height,
420
594
  hidden,
421
595
  format,
596
+ ...(breakBefore ? { breakBefore } : {}),
422
597
  };
423
598
  }
424
599
  convertColumnStyle(style) {
@@ -439,14 +614,16 @@ export class OdsStyles {
439
614
  const hidden = visibility === "collapse" ||
440
615
  visibility === "hidden" ||
441
616
  visibility === "none";
617
+ const breakBefore = columnProps?.["@_fo:break-before"] === "page";
442
618
  const format = this.normalizeCellFormat(this.convertToCellFormat(style));
443
- if (width === undefined && !hidden && !format) {
619
+ if (width === undefined && !hidden && !format && !breakBefore) {
444
620
  return undefined;
445
621
  }
446
622
  return {
447
623
  width,
448
624
  hidden,
449
625
  format,
626
+ ...(breakBefore ? { breakBefore } : {}),
450
627
  };
451
628
  }
452
629
  convertChartStyle(style) {
@@ -730,3 +907,100 @@ export class OdsStyles {
730
907
  return undefined;
731
908
  }
732
909
  }
910
+ const roundInches = (value) => Math.round(value * 1000) / 1000;
911
+ /** Children of the first `tagName` node in an order-preserving node list. */
912
+ const orderedChildren = (nodes, tagName) => {
913
+ if (!Array.isArray(nodes))
914
+ return undefined;
915
+ const found = nodes.find((node) => node && node[tagName]);
916
+ return found ? found[tagName] : undefined;
917
+ };
918
+ const ODS_FIELD_TAGS = {
919
+ "text:page-number": "page",
920
+ "text:page-count": "pages",
921
+ "text:date": "date",
922
+ "text:time": "time",
923
+ "text:sheet-name": "sheet",
924
+ "text:title": "sheet",
925
+ "text:file-name": "file",
926
+ };
927
+ /** One `<text:p>` (order-preserving children) → header/footer tokens. */
928
+ const odsParagraphToTokens = (children) => {
929
+ const tokens = [];
930
+ for (const child of children ?? []) {
931
+ if (!child || typeof child !== "object")
932
+ continue;
933
+ if (child["#text"] !== undefined) {
934
+ tokens.push({ type: "text", text: String(child["#text"]) });
935
+ continue;
936
+ }
937
+ const tag = Object.keys(child).find((key) => key !== ":@");
938
+ if (!tag)
939
+ continue;
940
+ const attrs = child[":@"] || {};
941
+ if (tag === "text:s") {
942
+ const count = parseInt(attrs["@_text:c"] ?? "1", 10);
943
+ tokens.push({ type: "text", text: " ".repeat(Number.isFinite(count) ? count : 1) });
944
+ continue;
945
+ }
946
+ if (tag === "text:tab") {
947
+ tokens.push({ type: "text", text: "\t" });
948
+ continue;
949
+ }
950
+ if (tag === "text:line-break") {
951
+ tokens.push({ type: "text", text: "\n" });
952
+ continue;
953
+ }
954
+ const field = ODS_FIELD_TAGS[tag];
955
+ if (field) {
956
+ // `<text:file-name text:display>`: `path` is the folder (`&Z`), `full`
957
+ // the folder + name (`&Z&F`); `name` / `name-and-extension` / absent
958
+ // is the file name (`&F`).
959
+ const display = field === "file" ? attrs["@_text:display"] : undefined;
960
+ if (display === "path" || display === "full") {
961
+ tokens.push({ type: "field", field: "path" });
962
+ }
963
+ if (display !== "path") {
964
+ tokens.push({ type: "field", field });
965
+ }
966
+ continue;
967
+ }
968
+ // `text:span`, `text:a`, … — descend.
969
+ tokens.push(...odsParagraphToTokens(child[tag]));
970
+ }
971
+ return tokens;
972
+ };
973
+ const odsRegionToCode = (children) => {
974
+ if (!Array.isArray(children))
975
+ return undefined;
976
+ const paragraphs = children
977
+ .filter((node) => node && (node["text:p"] || node["p"]))
978
+ .map((node) => headerFooterZoneFromTokens(odsParagraphToTokens(node["text:p"] || node["p"])));
979
+ const code = paragraphs.join("\n");
980
+ return code ? code : undefined;
981
+ };
982
+ /**
983
+ * `<style:header>` / `<style:footer>` (order-preserving children) → Excel
984
+ * header/footer code. Regions map to `&L` / `&C` / `&R`; paragraphs outside
985
+ * regions are the centre zone. `style:display="false"` yields nothing.
986
+ */
987
+ const odsHeaderFooterToCode = (children) => {
988
+ if (!Array.isArray(children))
989
+ return undefined;
990
+ const zones = {};
991
+ const left = odsRegionToCode(orderedChildren(children, "style:region-left") ||
992
+ orderedChildren(children, "region-left"));
993
+ const center = odsRegionToCode(orderedChildren(children, "style:region-center") ||
994
+ orderedChildren(children, "region-center"));
995
+ const right = odsRegionToCode(orderedChildren(children, "style:region-right") ||
996
+ orderedChildren(children, "region-right"));
997
+ const plain = odsRegionToCode(children);
998
+ if (left)
999
+ zones.left = left;
1000
+ if (center || plain)
1001
+ zones.center = center ?? plain;
1002
+ if (right)
1003
+ zones.right = right;
1004
+ const code = joinHeaderFooterZones(zones);
1005
+ return code ? code : undefined;
1006
+ };
@@ -1,5 +1,13 @@
1
- import { BaseWorkbookPlugin } from "../base/index";
2
- export declare class XlsPlugin extends BaseWorkbookPlugin {
3
- load(_buffer: ArrayBuffer | File, _password?: string): Promise<void>;
1
+ import { XlsxPlugin } from "../xlsx/index";
2
+ /**
3
+ * `.xls` handler. The BIFF (Excel 97-2003) binary format is not parsed;
4
+ * this plugin exists so a `.xls` file gets a clear, actionable error
5
+ * instead of falling through to the xlsx zip reader (which fails with an
6
+ * opaque "not a zip" error) or stalling in the password prompt. The one
7
+ * `.xls` shape that does load is an OOXML package saved with the wrong
8
+ * extension — Excel opens those too, so they are handed to the xlsx parser.
9
+ */
10
+ export declare class XlsPlugin extends XlsxPlugin {
11
+ load(buffer: ArrayBuffer | File, password?: string): Promise<void>;
4
12
  }
5
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,qBAAa,SAAU,SAAQ,kBAAkB;IACzC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xls/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoB3C;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACjC,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM;CAiBzD"}
@@ -1,7 +1,39 @@
1
- import { BaseWorkbookPlugin } from "../base/index";
2
- export class XlsPlugin extends BaseWorkbookPlugin {
3
- async load(_buffer, _password) {
4
- // TODO: Implement XLS loading (CFB format)
5
- console.warn("XLS support not implemented yet");
1
+ import { detectCfbContainerKind, LEGACY_XLS_UNSUPPORTED_MESSAGE, XLS_NOT_A_WORKBOOK_MESSAGE, } from "../../cfb-decryptor";
2
+ import { XlsxPlugin } from "../xlsx/index";
3
+ const ZIP_SIGNATURE = [0x50, 0x4b, 0x03, 0x04];
4
+ const CFB_SIGNATURE = [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1];
5
+ const readHeader = async (source, length) => {
6
+ const slice = source instanceof File
7
+ ? await source.slice(0, length).arrayBuffer()
8
+ : source.slice(0, length);
9
+ return new Uint8Array(slice);
10
+ };
11
+ const startsWith = (header, signature) => header.length >= signature.length &&
12
+ signature.every((byte, index) => header[index] === byte);
13
+ /**
14
+ * `.xls` handler. The BIFF (Excel 97-2003) binary format is not parsed;
15
+ * this plugin exists so a `.xls` file gets a clear, actionable error
16
+ * instead of falling through to the xlsx zip reader (which fails with an
17
+ * opaque "not a zip" error) or stalling in the password prompt. The one
18
+ * `.xls` shape that does load is an OOXML package saved with the wrong
19
+ * extension — Excel opens those too, so they are handed to the xlsx parser.
20
+ */
21
+ export class XlsPlugin extends XlsxPlugin {
22
+ async load(buffer, password) {
23
+ const header = await readHeader(buffer, CFB_SIGNATURE.length);
24
+ if (startsWith(header, ZIP_SIGNATURE)) {
25
+ return super.load(buffer, password);
26
+ }
27
+ if (startsWith(header, CFB_SIGNATURE)) {
28
+ // A CFB container: a BIFF workbook, or (when the caller skipped the
29
+ // WorkBook-level decryption) an encrypted package. Either way the
30
+ // legacy-workbook guidance is the actionable one for a .xls name.
31
+ const kind = await detectCfbContainerKind(buffer);
32
+ if (kind === "encrypted-ooxml") {
33
+ throw new Error("PASSWORD_REQUIRED");
34
+ }
35
+ throw new Error(LEGACY_XLS_UNSUPPORTED_MESSAGE);
36
+ }
37
+ throw new Error(XLS_NOT_A_WORKBOOK_MESSAGE);
6
38
  }
7
39
  }
@@ -2,6 +2,10 @@ import type { Color, IterativeCalculationOptions } from "@rowsncolumns/common-ty
2
2
  import type { BorderStyle, ConditionalFormatRule, DataValidationRuleRecord, EmbeddedChart, NamedRange, Sheet, SpreadsheetTheme, TableView } from "@rowsncolumns/spreadsheet";
3
3
  import type { EmbeddedObjectWithPosition, ProcessSheetDataResult } from "../../types";
4
4
  import { BaseWorkbookPlugin } from "../base/index";
5
+ export declare const parseBrtWsViewPayload: (payload: Uint8Array) => {
6
+ showGridLines: boolean;
7
+ rightToLeft: boolean;
8
+ };
5
9
  export declare const parseBrtNamePayload: (payload: Uint8Array, resolveSheetNameByXti?: (ixti: number) => string | undefined) => {
6
10
  name: string;
7
11
  formula: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xlsb/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EAEL,2BAA2B,EAE5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,WAAW,EAGX,qBAAqB,EACrB,wBAAwB,EAExB,aAAa,EACb,UAAU,EACV,KAAK,EACL,gB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"}
@@ -4,7 +4,7 @@ import { XMLParser } from "fast-xml-parser";
4
4
  import { get } from "lodash-es";
5
5
  import { parseRgce } from "./rgce-parser";
6
6
  import { StreamingZipParser } from "../../zip-parser-streaming";
7
- import { createFilterSpecsFromAutoFilter, excelColumnWidthToPixels, getRangeFromAddressRef, } from "../../helpers";
7
+ import { createFilterSpecsFromAutoFilter, excelColumnWidthToPixels, getRangeFromAddressRef, parseTableColumnTotals, } from "../../helpers";
8
8
  import { defaultSpreadsheetTheme } from "../../theme-default";
9
9
  import { BaseWorkbookPlugin } from "../base/index";
10
10
  import { processChart } from "../xlsx/charts";
@@ -274,10 +274,17 @@ const parseBrtShrFmla = (payload) => {
274
274
  const parseWsView = (payload) => {
275
275
  const reader = new Reader(payload);
276
276
  const flags = reader.readUInt16LE();
277
- // Bit 1 (0x0002): fShowGridLines - if 0, gridlines are hidden
278
- const showGridLines = (flags & 0x0002) !== 0;
279
- return { showGridLines };
277
+ // MS-XLSB 2.4.865 BrtWsView flag word: A fWnProt (0x0001), B fDspFmla
278
+ // (0x0002), C fDspGrid (0x0004), D fDspRwCol (0x0008), E fDspZeros
279
+ // (0x0010), F fRightToLeft (0x0020), G fSelected (0x0040), … Excel writes
280
+ // 0x039c for a plain sheet and 0x0398 for `showGridLines="0"`: gridlines
281
+ // are bit C, not bit B (which is "show formulas" and is normally clear).
282
+ const showGridLines = (flags & 0x0004) !== 0;
283
+ // OOXML `<sheetView rightToLeft="1">`.
284
+ const rightToLeft = (flags & 0x0020) !== 0;
285
+ return { showGridLines, rightToLeft };
280
286
  };
287
+ export const parseBrtWsViewPayload = parseWsView;
281
288
  const parsePane = (payload) => {
282
289
  const reader = new Reader(payload);
283
290
  const xSplit = reader.readFloat64LE();
@@ -1267,6 +1274,7 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1267
1274
  sheet.rowMetadata = stats.rowMetadata;
1268
1275
  sheet.columnMetadata = stats.columnMetadata;
1269
1276
  sheet.showGridLines = stats.showGridLines;
1277
+ sheet.rightToLeft = stats.rightToLeft;
1270
1278
  sheet.frozenRowCount = stats.frozenRowCount;
1271
1279
  sheet.frozenColumnCount = stats.frozenColumnCount;
1272
1280
  sheet.basicFilterRange = stats.basicFilterRange;
@@ -1532,12 +1540,13 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1532
1540
  : [];
1533
1541
  const columns = columnDefsArray.map((colDef) => {
1534
1542
  const name = colDef?.a$?.name || "";
1543
+ const totals = parseTableColumnTotals(colDef);
1535
1544
  const calculatedColumnFormula = get(colDef, "calculatedColumnFormula") ||
1536
1545
  get(colDef, "x:calculatedColumnFormula");
1537
1546
  if (calculatedColumnFormula) {
1538
- return { name, formula: calculatedColumnFormula };
1547
+ return { name, ...totals, formula: calculatedColumnFormula };
1539
1548
  }
1540
- return { name };
1549
+ return { name, ...totals };
1541
1550
  });
1542
1551
  const autoFilter = tableDefinition.autoFilter ?? tableDefinition["x:autoFilter"];
1543
1552
  const filterSpecs = createFilterSpecsFromAutoFilter(autoFilter);
@@ -1578,6 +1587,7 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1578
1587
  const rowMetadata = [];
1579
1588
  const columnMetadata = [];
1580
1589
  let showGridLines;
1590
+ let rightToLeft;
1581
1591
  let frozenRowCount;
1582
1592
  let frozenColumnCount;
1583
1593
  let basicFilterRange;
@@ -1587,6 +1597,8 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1587
1597
  if (record.type === RT.BrtWsView) {
1588
1598
  const view = parseWsView(payload);
1589
1599
  showGridLines = view.showGridLines;
1600
+ if (view.rightToLeft)
1601
+ rightToLeft = true;
1590
1602
  continue;
1591
1603
  }
1592
1604
  if (record.type === RT.BrtPane) {
@@ -1671,6 +1683,7 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1671
1683
  rowMetadata,
1672
1684
  columnMetadata,
1673
1685
  showGridLines,
1686
+ rightToLeft,
1674
1687
  frozenRowCount,
1675
1688
  frozenColumnCount,
1676
1689
  basicFilterRange,
@@ -1727,6 +1740,7 @@ export class XlsbPlugin extends BaseWorkbookPlugin {
1727
1740
  ...(sheet.showGridLines !== undefined
1728
1741
  ? { showGridLines: sheet.showGridLines }
1729
1742
  : {}),
1743
+ ...(sheet.rightToLeft ? { rightToLeft: true } : {}),
1730
1744
  ...(sheet.frozenRowCount !== undefined && sheet.frozenRowCount > 0
1731
1745
  ? { frozenRowCount: sheet.frozenRowCount }
1732
1746
  : {}),
@@ -17,6 +17,16 @@ export declare function extractChartDataRange(plotArea: any, chartType: string,
17
17
  export declare function extractHiddenDimensionStrategy(chart: any): HIDDEN_DIMENSION_STRATEGY | undefined;
18
18
  export declare function extractChartTitle(chart: any): string;
19
19
  export declare function determineChartType(chart: any): "bar" | "column" | "line" | "pie" | "doughnut" | "area" | "radar" | "stock" | "scatter" | "bubble" | "treemap" | "sunburst" | "histogram" | "boxplot" | "waterfall" | "funnel";
20
+ /**
21
+ * The authored 3-D / surface chart class, when the plot area's chart
22
+ * element is one of Excel's 3-D variants. These degrade to their 2-D
23
+ * `chartType` (bar3DChart → bar/column, line3DChart → line, pie3DChart →
24
+ * pie, area3DChart / surfaceChart / surface3DChart → area) and the
25
+ * original class is preserved verbatim as `sourceChartType`, matching the
26
+ * Rust importer, so the renderer's echarts-gl pipeline and the exporter's
27
+ * 3-D writer can restore it. Undefined for plain 2-D charts.
28
+ */
29
+ export declare function extractThreeDSourceChartType(plotArea: any): "BAR_3D" | "LINE_3D" | "PIE_3D" | "AREA_3D" | "SURFACE" | "SURFACE_3D" | undefined;
20
30
  /**
21
31
  * Phase 5.5 — pull binCount out of the c15:histogramChart extension
22
32
  * marker. Returns undefined if absent.