docx 9.3.0 → 9.4.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
 
3
+ import { default as default_2 } from 'jszip';
3
4
  import { Element as Element_2 } from 'xml-js';
4
5
  import { Stream } from 'stream';
5
6
 
@@ -190,7 +191,7 @@ declare class Break extends XmlComponent {
190
191
  constructor();
191
192
  }
192
193
 
193
- export declare class BuilderElement<T extends AttributeData> extends XmlComponent {
194
+ export declare class BuilderElement<T extends AttributeData = {}> extends XmlComponent {
194
195
  constructor({ name, attributes, children, }: {
195
196
  readonly name: string;
196
197
  readonly attributes?: AttributePayload<T>;
@@ -202,6 +203,11 @@ export declare class CarriageReturn extends EmptyElement {
202
203
  constructor();
203
204
  }
204
205
 
206
+ declare const CellSpacingType: {
207
+ readonly DXA: "dxa";
208
+ readonly NIL: "nil";
209
+ };
210
+
205
211
  export declare const CharacterSet: {
206
212
  readonly ANSI: "00";
207
213
  readonly DEFAULT: "01";
@@ -272,7 +278,9 @@ export declare class CommentReference extends XmlComponent {
272
278
  }
273
279
 
274
280
  export declare class Comments extends XmlComponent {
281
+ private readonly relationships;
275
282
  constructor({ children }: ICommentsOptions);
283
+ get Relationships(): Relationships;
276
284
  }
277
285
 
278
286
  declare const CompoundLine: {
@@ -330,12 +338,42 @@ declare class CoreProperties extends XmlComponent {
330
338
  constructor(options: Omit<IPropertiesOptions, "sections">);
331
339
  }
332
340
 
341
+ export declare const createDocumentGrid: ({ type, linePitch, charSpace }: IDocGridAttributesProperties) => XmlComponent;
342
+
333
343
  export declare const createFrameProperties: (options: IFrameOptions) => XmlComponent;
334
344
 
345
+ export declare const createHorizontalPosition: ({ relative, align, offset }: IHorizontalPositionOptions) => XmlComponent;
346
+
335
347
  export declare const createLineNumberType: ({ countBy, start, restart, distance }: ILineNumberAttributes) => XmlComponent;
336
348
 
349
+ export declare const createMathAccentCharacter: ({ accent }: MathAccentCharacterOptions) => XmlComponent;
350
+
351
+ export declare const createMathBase: ({ children }: MathBaseOptions) => XmlComponent;
352
+
353
+ export declare const createMathLimitLocation: ({ value }: MathLimitLocationOptions) => XmlComponent;
354
+
355
+ export declare const createMathNAryProperties: ({ accent, hasSuperScript, hasSubScript, limitLocationVal, }: MathNAryPropertiesOptions) => XmlComponent;
356
+
357
+ export declare const createMathPreSubSuperScriptProperties: () => XmlComponent;
358
+
359
+ export declare const createMathSubScriptElement: ({ children }: MathSubScriptElementOptions) => XmlComponent;
360
+
361
+ export declare const createMathSubScriptProperties: () => XmlComponent;
362
+
363
+ export declare const createMathSubSuperScriptProperties: () => XmlComponent;
364
+
365
+ export declare const createMathSuperScriptElement: ({ children }: MathSuperScriptElementOptions) => XmlComponent;
366
+
367
+ export declare const createMathSuperScriptProperties: () => XmlComponent;
368
+
369
+ export declare const createPageSize: ({ width, height, orientation, code }: IPageSizeAttributes) => XmlComponent;
370
+
371
+ export declare const createSimplePos: () => XmlComponent;
372
+
337
373
  export declare const createStringElement: (name: string, value: string) => XmlComponent;
338
374
 
375
+ export declare const createVerticalPosition: ({ relative, align, offset }: IVerticalPositionOptions) => XmlComponent;
376
+
339
377
  declare class CustomProperties extends XmlComponent {
340
378
  private nextId;
341
379
  private readonly properties;
@@ -365,14 +403,6 @@ declare class DeletedTextRunWrapper extends XmlComponent {
365
403
  constructor(options: IRunOptions);
366
404
  }
367
405
 
368
- export declare class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesProperties> {
369
- protected readonly xmlKeys: {
370
- type: string;
371
- linePitch: string;
372
- charSpace: string;
373
- };
374
- }
375
-
376
406
  declare type DocPropertiesOptions = {
377
407
  readonly name: string;
378
408
  readonly description: string;
@@ -459,10 +489,6 @@ export declare class DocumentDefaults extends XmlComponent {
459
489
  constructor(options: IDocumentDefaultsOptions);
460
490
  }
461
491
 
462
- export declare class DocumentGrid extends XmlComponent {
463
- constructor(linePitch: number, charSpace?: number, type?: (typeof DocumentGridType)[keyof typeof DocumentGridType]);
464
- }
465
-
466
492
  export declare const DocumentGridType: {
467
493
  readonly DEFAULT: "default";
468
494
  readonly LINES: "lines";
@@ -758,10 +784,6 @@ export declare const HighlightColor: {
758
784
  readonly YELLOW: "yellow";
759
785
  };
760
786
 
761
- export declare class HorizontalPosition extends XmlComponent {
762
- constructor(horizontalPosition: IHorizontalPositionOptions);
763
- }
764
-
765
787
  export declare const HorizontalPositionAlign: {
766
788
  readonly CENTER: "center";
767
789
  readonly INSIDE: "inside";
@@ -1004,7 +1026,7 @@ export declare type IDistance = {
1004
1026
 
1005
1027
  export declare type IDocGridAttributesProperties = {
1006
1028
  readonly type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];
1007
- readonly linePitch?: number;
1029
+ readonly linePitch: number;
1008
1030
  readonly charSpace?: number;
1009
1031
  };
1010
1032
 
@@ -1280,7 +1302,7 @@ export declare abstract class InitializableXmlComponent extends XmlComponent {
1280
1302
  constructor(rootKey: string, initComponent?: InitializableXmlComponent);
1281
1303
  }
1282
1304
 
1283
- export declare type InputDataType = Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream;
1305
+ export declare type InputDataType = Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream | default_2;
1284
1306
 
1285
1307
  export declare class InsertedTextRun extends XmlComponent {
1286
1308
  constructor(options: IInsertedRunOptions);
@@ -1341,9 +1363,10 @@ export declare type IPageReferenceOptions = {
1341
1363
  };
1342
1364
 
1343
1365
  export declare type IPageSizeAttributes = {
1344
- readonly width?: number | PositiveUniversalMeasure;
1345
- readonly height?: number | PositiveUniversalMeasure;
1366
+ readonly width: number | PositiveUniversalMeasure;
1367
+ readonly height: number | PositiveUniversalMeasure;
1346
1368
  readonly orientation?: (typeof PageOrientation)[keyof typeof PageOrientation];
1369
+ readonly code?: number;
1347
1370
  };
1348
1371
 
1349
1372
  export declare type IParagraphOptions = {
@@ -1489,13 +1512,13 @@ export declare type ISectionOptions = {
1489
1512
 
1490
1513
  export declare type ISectionPropertiesOptions = {
1491
1514
  readonly page?: {
1492
- readonly size?: IPageSizeAttributes;
1515
+ readonly size?: Partial<IPageSizeAttributes>;
1493
1516
  readonly margin?: IPageMarginAttributes;
1494
1517
  readonly pageNumbers?: IPageNumberTypeAttributes;
1495
1518
  readonly borders?: IPageBordersOptions;
1496
1519
  readonly textDirection?: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType];
1497
1520
  };
1498
- readonly grid?: IDocGridAttributesProperties;
1521
+ readonly grid?: Partial<IDocGridAttributesProperties>;
1499
1522
  readonly headerWrapperGroup?: IHeaderFooterGroup<HeaderWrapper>;
1500
1523
  readonly footerWrapperGroup?: IHeaderFooterGroup<FooterWrapper>;
1501
1524
  readonly lineNumbers?: ILineNumberAttributes;
@@ -1603,6 +1626,11 @@ declare type ITableCellPropertiesOptions = {
1603
1626
  readonly borders?: ITableCellBorders;
1604
1627
  };
1605
1628
 
1629
+ declare type ITableCellSpacingProperties = {
1630
+ readonly value: number | Percentage | UniversalMeasure;
1631
+ readonly type?: (typeof CellSpacingType)[keyof typeof CellSpacingType];
1632
+ };
1633
+
1606
1634
  export declare type ITableFloatOptions = {
1607
1635
  readonly horizontalAnchor?: (typeof TableAnchorType)[keyof typeof TableAnchorType];
1608
1636
  readonly absoluteHorizontalPosition?: number | UniversalMeasure;
@@ -1648,6 +1676,7 @@ export declare type ITableOptions = {
1648
1676
  readonly borders?: ITableBordersOptions;
1649
1677
  readonly alignment?: (typeof AlignmentType)[keyof typeof AlignmentType];
1650
1678
  readonly visuallyRightToLeft?: boolean;
1679
+ readonly cellSpacing?: ITableCellSpacingProperties;
1651
1680
  };
1652
1681
 
1653
1682
  export declare type ITablePropertiesOptions = {
@@ -1661,6 +1690,7 @@ export declare type ITablePropertiesOptions = {
1661
1690
  readonly alignment?: (typeof AlignmentType)[keyof typeof AlignmentType];
1662
1691
  readonly cellMargin?: ITableCellMarginOptions;
1663
1692
  readonly visuallyRightToLeft?: boolean;
1693
+ readonly cellSpacing?: ITableCellSpacingProperties;
1664
1694
  };
1665
1695
 
1666
1696
  export declare type ITableRowOptions = {
@@ -1674,6 +1704,7 @@ export declare type ITableRowPropertiesOptions = {
1674
1704
  readonly value: number | PositiveUniversalMeasure;
1675
1705
  readonly rule: (typeof HeightRule)[keyof typeof HeightRule];
1676
1706
  };
1707
+ readonly cellSpacing?: ITableCellSpacingProperties;
1677
1708
  };
1678
1709
 
1679
1710
  export declare type ITableWidthProperties = {
@@ -1849,19 +1880,21 @@ declare class Math_2 extends XmlComponent {
1849
1880
  }
1850
1881
  export { Math_2 as Math }
1851
1882
 
1852
- export declare class MathAccentCharacter extends XmlComponent {
1853
- constructor(accent: string);
1854
- }
1883
+ declare type MathAccentCharacterOptions = {
1884
+ readonly accent: string;
1885
+ };
1855
1886
 
1856
1887
  export declare class MathAngledBrackets extends XmlComponent {
1857
- constructor(options: {
1858
- readonly children: readonly MathComponent[];
1859
- });
1888
+ constructor(options: MathAngledBracketsOptions);
1860
1889
  }
1861
1890
 
1862
- export declare class MathBase extends XmlComponent {
1863
- constructor(children: readonly MathComponent[]);
1864
- }
1891
+ declare type MathAngledBracketsOptions = {
1892
+ readonly children: readonly MathComponent[];
1893
+ };
1894
+
1895
+ declare type MathBaseOptions = {
1896
+ readonly children: readonly MathComponent[];
1897
+ };
1865
1898
 
1866
1899
  export declare type MathComponent = MathRun | MathFraction | MathSum | MathIntegral | MathSuperScript | MathSubScript | MathSubSuperScript | MathRadical | MathFunction | MathRoundBrackets | MathCurlyBrackets | MathAngledBrackets | MathSquareBrackets;
1867
1900
 
@@ -1903,9 +1936,9 @@ export declare class MathLimit extends XmlComponent {
1903
1936
  constructor(children: readonly MathComponent[]);
1904
1937
  }
1905
1938
 
1906
- export declare class MathLimitLocation extends XmlComponent {
1907
- constructor(value?: string);
1908
- }
1939
+ declare type MathLimitLocationOptions = {
1940
+ readonly value?: string;
1941
+ };
1909
1942
 
1910
1943
  export declare class MathLimitLower extends XmlComponent {
1911
1944
  constructor(options: IMathLimitLowerOptions);
@@ -1915,20 +1948,19 @@ export declare class MathLimitUpper extends XmlComponent {
1915
1948
  constructor(options: IMathLimitUpperOptions);
1916
1949
  }
1917
1950
 
1918
- export declare class MathNAryProperties extends XmlComponent {
1919
- constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean, limitLocationVal?: string);
1920
- }
1951
+ declare type MathNAryPropertiesOptions = {
1952
+ readonly accent: string;
1953
+ readonly hasSuperScript: boolean;
1954
+ readonly hasSubScript: boolean;
1955
+ readonly limitLocationVal?: string;
1956
+ };
1921
1957
 
1922
1958
  export declare class MathNumerator extends XmlComponent {
1923
1959
  constructor(children: readonly MathComponent[]);
1924
1960
  }
1925
1961
 
1926
- export declare class MathPreSubSuperScript extends XmlComponent {
1927
- constructor(options: IMathPreSubSuperScriptOptions);
1928
- }
1929
-
1930
- export declare class MathPreSubSuperScriptProperties extends XmlComponent {
1931
- constructor();
1962
+ export declare class MathPreSubSuperScript extends BuilderElement {
1963
+ constructor({ children, subScript, superScript }: IMathPreSubSuperScriptOptions);
1932
1964
  }
1933
1965
 
1934
1966
  export declare class MathRadical extends XmlComponent {
@@ -1959,22 +1991,14 @@ export declare class MathSubScript extends XmlComponent {
1959
1991
  constructor(options: IMathSubScriptOptions);
1960
1992
  }
1961
1993
 
1962
- export declare class MathSubScriptElement extends XmlComponent {
1963
- constructor(children: readonly MathComponent[]);
1964
- }
1965
-
1966
- export declare class MathSubScriptProperties extends XmlComponent {
1967
- constructor();
1968
- }
1994
+ declare type MathSubScriptElementOptions = {
1995
+ readonly children: readonly MathComponent[];
1996
+ };
1969
1997
 
1970
1998
  export declare class MathSubSuperScript extends XmlComponent {
1971
1999
  constructor(options: IMathSubSuperScriptOptions);
1972
2000
  }
1973
2001
 
1974
- export declare class MathSubSuperScriptProperties extends XmlComponent {
1975
- constructor();
1976
- }
1977
-
1978
2002
  export declare class MathSum extends XmlComponent {
1979
2003
  constructor(options: IMathSumOptions);
1980
2004
  }
@@ -1983,13 +2007,9 @@ export declare class MathSuperScript extends XmlComponent {
1983
2007
  constructor(options: IMathSuperScriptOptions);
1984
2008
  }
1985
2009
 
1986
- export declare class MathSuperScriptElement extends XmlComponent {
1987
- constructor(children: readonly MathComponent[]);
1988
- }
1989
-
1990
- export declare class MathSuperScriptProperties extends XmlComponent {
1991
- constructor();
1992
- }
2010
+ declare type MathSuperScriptElementOptions = {
2011
+ readonly children: readonly MathComponent[];
2012
+ };
1993
2013
 
1994
2014
  export declare const measurementOrPercentValue: (val: number | Percentage | UniversalMeasure) => number | UniversalMeasure | Percentage;
1995
2015
 
@@ -2244,10 +2264,6 @@ export declare class PageReference extends Run {
2244
2264
  constructor(bookmarkId: string, options?: IPageReferenceOptions);
2245
2265
  }
2246
2266
 
2247
- export declare class PageSize extends XmlComponent {
2248
- constructor(width: number | PositiveUniversalMeasure, height: number | PositiveUniversalMeasure, orientation: (typeof PageOrientation)[keyof typeof PageOrientation]);
2249
- }
2250
-
2251
2267
  export declare class PageTextDirection extends XmlComponent {
2252
2268
  constructor(value: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType]);
2253
2269
  }
@@ -2288,13 +2304,18 @@ declare type PatchDetectorOptions = {
2288
2304
  readonly data: InputDataType;
2289
2305
  };
2290
2306
 
2291
- export declare const patchDocument: <T extends keyof OutputByType = keyof OutputByType>({ outputType, data, patches, keepOriginalStyles, }: PatchDocumentOptions<T>) => Promise<OutputByType[T]>;
2307
+ export declare const patchDocument: <T extends keyof OutputByType = keyof OutputByType>({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters, recursive, }: PatchDocumentOptions<T>) => Promise<OutputByType[T]>;
2292
2308
 
2293
2309
  export declare type PatchDocumentOptions<T extends PatchDocumentOutputType = PatchDocumentOutputType> = {
2294
2310
  readonly outputType: T;
2295
2311
  readonly data: InputDataType;
2296
2312
  readonly patches: Readonly<Record<string, IPatch>>;
2297
2313
  readonly keepOriginalStyles?: boolean;
2314
+ readonly placeholderDelimiters?: Readonly<{
2315
+ readonly start: string;
2316
+ readonly end: string;
2317
+ }>;
2318
+ readonly recursive?: boolean;
2298
2319
  };
2299
2320
 
2300
2321
  export declare type PatchDocumentOutputType = OutputType;
@@ -2551,10 +2572,6 @@ export declare class SimpleMailMergeField extends SimpleField {
2551
2572
  constructor(fieldName: string);
2552
2573
  }
2553
2574
 
2554
- export declare class SimplePos extends XmlComponent {
2555
- constructor();
2556
- }
2557
-
2558
2575
  export declare class SoftHyphen extends EmptyElement {
2559
2576
  constructor();
2560
2577
  }
@@ -2641,7 +2658,7 @@ export declare class TabAttributes extends XmlAttributeComponent<{
2641
2658
  }
2642
2659
 
2643
2660
  export declare class Table extends FileChild {
2644
- constructor({ rows, width, columnWidths, margins, indent, float, layout, style, borders, alignment, visuallyRightToLeft, }: ITableOptions);
2661
+ constructor({ rows, width, columnWidths, margins, indent, float, layout, style, borders, alignment, visuallyRightToLeft, cellSpacing, }: ITableOptions);
2645
2662
  }
2646
2663
 
2647
2664
  export declare const TableAnchorType: {
@@ -2904,10 +2921,6 @@ export declare const VerticalMergeType: {
2904
2921
  readonly RESTART: "restart";
2905
2922
  };
2906
2923
 
2907
- export declare class VerticalPosition extends XmlComponent {
2908
- constructor(verticalPosition: IVerticalPositionOptions);
2909
- }
2910
-
2911
2924
  export declare const VerticalPositionAlign: {
2912
2925
  readonly BOTTOM: "bottom";
2913
2926
  readonly CENTER: "center";