@silurus/ooxml 0.40.0 → 0.42.0

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.
@@ -99,6 +99,9 @@ export declare interface DocParagraph {
99
99
  styleId?: string | null;
100
100
  /** Default font size (pt) inherited from style + direct pPr/rPr. Falls back to 10pt. */
101
101
  defaultFontSize?: number;
102
+ /** Default font family resolved from the style chain. Used to size empty
103
+ * paragraphs (no runs) with the intended font's line metrics. */
104
+ defaultFontFamily?: string | null;
102
105
  }
103
106
 
104
107
  export declare interface DocRevision {
@@ -141,6 +144,13 @@ declare interface DocTableCell {
141
144
  background: string | null;
142
145
  vAlign: 'top' | 'center' | 'bottom';
143
146
  widthPt: number | null;
147
+ /** Per-cell margins (pt) from `<w:tcPr><w:tcMar>` (ECMA-376 §17.4.42). Each
148
+ * edge overrides the table-level `cellMargin*` default when set; null/absent
149
+ * = inherit the table default. */
150
+ marginTop?: number | null;
151
+ marginBottom?: number | null;
152
+ marginLeft?: number | null;
153
+ marginRight?: number | null;
144
154
  }
145
155
 
146
156
  declare interface DocTableRow {
@@ -496,6 +496,14 @@ declare interface ChartSeries {
496
496
  * fall back to the chart-level `dataLabelFontColor`.
497
497
  */
498
498
  dataLabelColors?: (string | null)[] | null;
499
+ /**
500
+ * Series-level data-label text colour (`<c:ser><c:dLbls><c:txPr>…solidFill`,
501
+ * ECMA-376 §21.2.2.216). Hex without '#'. Stacked-bar charts colour each
502
+ * segment's label independently (e.g. white on the dark segment, black on
503
+ * the light one), which a single chart-level `dataLabelFontColor` can't
504
+ * express. Takes precedence over `dataLabelFontColor`; null = no override.
505
+ */
506
+ labelColor?: string | null;
499
507
  /**
500
508
  * Mixed chart: per-series chart type override. Currently only "line" (XLSX)
501
509
  * is honoured; other values are treated as the chart's primary type.
@@ -660,6 +668,9 @@ declare interface DocParagraph {
660
668
  styleId?: string | null;
661
669
  /** Default font size (pt) inherited from style + direct pPr/rPr. Falls back to 10pt. */
662
670
  defaultFontSize?: number;
671
+ /** Default font family resolved from the style chain. Used to size empty
672
+ * paragraphs (no runs) with the intended font's line metrics. */
673
+ defaultFontFamily?: string | null;
663
674
  }
664
675
 
665
676
  declare interface DocRevision {
@@ -702,6 +713,13 @@ declare interface DocTableCell {
702
713
  background: string | null;
703
714
  vAlign: 'top' | 'center' | 'bottom';
704
715
  widthPt: number | null;
716
+ /** Per-cell margins (pt) from `<w:tcPr><w:tcMar>` (ECMA-376 §17.4.42). Each
717
+ * edge overrides the table-level `cellMargin*` default when set; null/absent
718
+ * = inherit the table default. */
719
+ marginTop?: number | null;
720
+ marginBottom?: number | null;
721
+ marginLeft?: number | null;
722
+ marginRight?: number | null;
705
723
  }
706
724
 
707
725
  declare interface DocTableRow {
@@ -1807,6 +1825,10 @@ declare interface ShapeElement {
1807
1825
  softEdge?: SoftEdge;
1808
1826
  /** Mirrored reflection — ECMA-376 §20.1.8.27. */
1809
1827
  reflection?: Reflection;
1828
+ /** Explicit text frame from a SmartArt drawing's `<dsp:txXfrm>` (absolute EMU,
1829
+ * same space as x/y/width/height). When present the renderer lays text out in
1830
+ * this rectangle instead of the preset/ellipse-derived text rectangle. */
1831
+ textRect?: TextRect;
1810
1832
  }
1811
1833
 
1812
1834
  declare type ShapeFill = {
@@ -2200,6 +2222,17 @@ declare interface TextBody {
2200
2222
  vert: string;
2201
2223
  /** Auto-fit: "sp" = shape grows to fit text, "norm" = font shrinks, "none" = no fit */
2202
2224
  autoFit: string;
2225
+ /**
2226
+ * `<a:normAutofit fontScale>` (ECMA-376 §21.1.2.1.3) — PowerPoint's stored,
2227
+ * pre-computed font-shrink ratio for `autoFit === "norm"`, as a fraction
2228
+ * (e.g. 0.625 for `fontScale="62500"`). Null/absent when PowerPoint stored no
2229
+ * scale; the renderer then re-derives one. Applying the stored value matches
2230
+ * PowerPoint exactly instead of guessing from our own text metrics.
2231
+ */
2232
+ fontScale?: number | null;
2233
+ /** `<a:normAutofit lnSpcReduction>` — stored line-spacing reduction fraction
2234
+ * (e.g. 0.20 for `lnSpcReduction="20000"`). Null/absent when not stored. */
2235
+ lnSpcReduction?: number | null;
2203
2236
  /**
2204
2237
  * `<a:bodyPr numCol>` (ECMA-376 §20.1.10.34) — number of text columns inside
2205
2238
  * the shape. Defaults to 1; values > 1 cause the renderer to flow paragraphs
@@ -2217,6 +2250,14 @@ declare interface TextOutline {
2217
2250
  color?: string;
2218
2251
  }
2219
2252
 
2253
+ /** Absolute text-frame rectangle in EMU (from SmartArt `<dsp:txXfrm>`). */
2254
+ declare interface TextRect {
2255
+ x: number;
2256
+ y: number;
2257
+ width: number;
2258
+ height: number;
2259
+ }
2260
+
2220
2261
  declare type TextRun = TextRunData | LineBreak;
2221
2262
 
2222
2263
  declare interface TextRun_2 {
@@ -2488,6 +2529,10 @@ declare interface XlsxChartSeries {
2488
2529
  /** `<c:val>/<c:numRef>/<c:formatCode>` — Excel number format for series
2489
2530
  * values (ECMA-376 §21.2.2.37). */
2490
2531
  valFormatCode?: string | null;
2532
+ /** `<c:ser><c:dLbls><c:txPr>…solidFill` — per-series data-label text color
2533
+ * (ECMA-376 §21.2.2.216). Takes precedence over the chart-level color so
2534
+ * each series can color its labels independently. */
2535
+ labelColor?: string | null;
2491
2536
  /** `<c:ser><c:order>` — stacking/legend display order (§21.2.2.28). */
2492
2537
  order?: number;
2493
2538
  /** `<c:marker><c:symbol val>` — point marker shape (ECMA-376 §21.2.2.32). */
@@ -191,6 +191,14 @@ declare interface ChartSeries {
191
191
  * fall back to the chart-level `dataLabelFontColor`.
192
192
  */
193
193
  dataLabelColors?: (string | null)[] | null;
194
+ /**
195
+ * Series-level data-label text colour (`<c:ser><c:dLbls><c:txPr>…solidFill`,
196
+ * ECMA-376 §21.2.2.216). Hex without '#'. Stacked-bar charts colour each
197
+ * segment's label independently (e.g. white on the dark segment, black on
198
+ * the light one), which a single chart-level `dataLabelFontColor` can't
199
+ * express. Takes precedence over `dataLabelFontColor`; null = no override.
200
+ */
201
+ labelColor?: string | null;
194
202
  /**
195
203
  * Mixed chart: per-series chart type override. Currently only "line" (XLSX)
196
204
  * is honoured; other values are treated as the chart's primary type.
@@ -734,6 +742,10 @@ export declare interface ShapeElement {
734
742
  softEdge?: SoftEdge;
735
743
  /** Mirrored reflection — ECMA-376 §20.1.8.27. */
736
744
  reflection?: Reflection;
745
+ /** Explicit text frame from a SmartArt drawing's `<dsp:txXfrm>` (absolute EMU,
746
+ * same space as x/y/width/height). When present the renderer lays text out in
747
+ * this rectangle instead of the preset/ellipse-derived text rectangle. */
748
+ textRect?: TextRect;
737
749
  }
738
750
 
739
751
  export declare interface Slide {
@@ -847,6 +859,17 @@ export declare interface TextBody {
847
859
  vert: string;
848
860
  /** Auto-fit: "sp" = shape grows to fit text, "norm" = font shrinks, "none" = no fit */
849
861
  autoFit: string;
862
+ /**
863
+ * `<a:normAutofit fontScale>` (ECMA-376 §21.1.2.1.3) — PowerPoint's stored,
864
+ * pre-computed font-shrink ratio for `autoFit === "norm"`, as a fraction
865
+ * (e.g. 0.625 for `fontScale="62500"`). Null/absent when PowerPoint stored no
866
+ * scale; the renderer then re-derives one. Applying the stored value matches
867
+ * PowerPoint exactly instead of guessing from our own text metrics.
868
+ */
869
+ fontScale?: number | null;
870
+ /** `<a:normAutofit lnSpcReduction>` — stored line-spacing reduction fraction
871
+ * (e.g. 0.20 for `lnSpcReduction="20000"`). Null/absent when not stored. */
872
+ lnSpcReduction?: number | null;
850
873
  /**
851
874
  * `<a:bodyPr numCol>` (ECMA-376 §20.1.10.34) — number of text columns inside
852
875
  * the shape. Defaults to 1; values > 1 cause the renderer to flow paragraphs
@@ -864,6 +887,14 @@ declare interface TextOutline {
864
887
  color?: string;
865
888
  }
866
889
 
890
+ /** Absolute text-frame rectangle in EMU (from SmartArt `<dsp:txXfrm>`). */
891
+ declare interface TextRect {
892
+ x: number;
893
+ y: number;
894
+ width: number;
895
+ height: number;
896
+ }
897
+
867
898
  export declare type TextRun = TextRunData | LineBreak;
868
899
 
869
900
  export declare type TextRunCallback = (run: TextRunInfo) => void;
@@ -913,6 +913,10 @@ declare interface XlsxChartSeries {
913
913
  /** `<c:val>/<c:numRef>/<c:formatCode>` — Excel number format for series
914
914
  * values (ECMA-376 §21.2.2.37). */
915
915
  valFormatCode?: string | null;
916
+ /** `<c:ser><c:dLbls><c:txPr>…solidFill` — per-series data-label text color
917
+ * (ECMA-376 §21.2.2.216). Takes precedence over the chart-level color so
918
+ * each series can color its labels independently. */
919
+ labelColor?: string | null;
916
920
  /** `<c:ser><c:order>` — stacking/legend display order (§21.2.2.28). */
917
921
  order?: number;
918
922
  /** `<c:marker><c:symbol val>` — point marker shape (ECMA-376 §21.2.2.32). */