docx 9.8.1 → 9.10.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/charts.cjs +18 -10
- package/dist/charts.iife.js +18 -10
- package/dist/charts.mjs +18 -10
- package/dist/charts.umd.cjs +18 -10
- package/dist/index.cjs +2480 -361
- package/dist/index.d.cts +668 -38
- package/dist/index.d.ts +668 -38
- package/dist/index.iife.js +2480 -361
- package/dist/index.mjs +2473 -362
- package/dist/index.umd.cjs +2480 -361
- package/dist/layout.cjs +50855 -0
- package/dist/layout.d.cts +385 -0
- package/dist/layout.d.ts +385 -0
- package/dist/layout.iife.js +50858 -0
- package/dist/layout.mjs +50851 -0
- package/dist/layout.umd.cjs +50859 -0
- package/dist/math.cjs +7 -7
- package/dist/math.iife.js +7 -7
- package/dist/math.mjs +7 -7
- package/dist/math.umd.cjs +7 -7
- package/dist/shapes.cjs +2051 -2470
- package/dist/shapes.iife.js +2051 -2470
- package/dist/shapes.mjs +2051 -2470
- package/dist/shapes.umd.cjs +2051 -2470
- package/dist/watermarks.cjs +4 -4
- package/dist/watermarks.iife.js +4 -4
- package/dist/watermarks.mjs +4 -4
- package/dist/watermarks.umd.cjs +4 -4
- package/package.json +21 -7
package/dist/index.d.ts
CHANGED
|
@@ -103,11 +103,11 @@ export declare const abstractNumUniqueNumericIdGen: () => UniqueNumericIdCreator
|
|
|
103
103
|
* @publicApi
|
|
104
104
|
*/
|
|
105
105
|
export declare const AlignmentType: {
|
|
106
|
-
/** Align Start */
|
|
106
|
+
/** Align Start: the left in a left-to-right paragraph, and the right in a `bidirectional` (right-to-left) paragraph */
|
|
107
107
|
readonly START: "start";
|
|
108
108
|
/** Align Center */
|
|
109
109
|
readonly CENTER: "center";
|
|
110
|
-
/** End */
|
|
110
|
+
/** Align End: the right in a left-to-right paragraph, and the left in a `bidirectional` (right-to-left) paragraph */
|
|
111
111
|
readonly END: "end";
|
|
112
112
|
/** Justified */
|
|
113
113
|
readonly BOTH: "both";
|
|
@@ -123,9 +123,9 @@ export declare const AlignmentType: {
|
|
|
123
123
|
readonly LOW_KASHIDA: "lowKashida";
|
|
124
124
|
/** Thai Language Justification */
|
|
125
125
|
readonly THAI_DISTRIBUTE: "thaiDistribute";
|
|
126
|
-
/** Align Left */
|
|
126
|
+
/** Align Left: a paragraph stays on the left of the page even when it is `bidirectional` (right-to-left) */
|
|
127
127
|
readonly LEFT: "left";
|
|
128
|
-
/** Align Right */
|
|
128
|
+
/** Align Right: a paragraph stays on the right of the page even when it is `bidirectional` (right-to-left) */
|
|
129
129
|
readonly RIGHT: "right";
|
|
130
130
|
/** Justified */
|
|
131
131
|
readonly JUSTIFIED: "both";
|
|
@@ -383,10 +383,13 @@ declare class Body_2 extends XmlComponent {
|
|
|
383
383
|
/**
|
|
384
384
|
* Section properties that were moved into a paragraph at the end of their section
|
|
385
385
|
* by {@link addSection}, keyed by that paragraph. Used to find the section that
|
|
386
|
-
* governs a given child of the body
|
|
386
|
+
* governs a given child of the body, and to write each section's properties into
|
|
387
|
+
* its paragraph while the body is written.
|
|
387
388
|
*/
|
|
388
389
|
private readonly sectionParagraphs;
|
|
389
|
-
|
|
390
|
+
private readonly headingBookmarkIds;
|
|
391
|
+
private readonly pageNumbers?;
|
|
392
|
+
constructor({ pageNumbers }?: IBodyOptions);
|
|
390
393
|
/**
|
|
391
394
|
* Finds the section properties that govern a top-level child of the body.
|
|
392
395
|
*
|
|
@@ -403,8 +406,10 @@ declare class Body_2 extends XmlComponent {
|
|
|
403
406
|
/**
|
|
404
407
|
* Adds new section properties to the document body.
|
|
405
408
|
*
|
|
406
|
-
* Creates a new section by moving the previous section's properties into
|
|
407
|
-
*
|
|
409
|
+
* Creates a new section by moving the previous section's properties into the last
|
|
410
|
+
* paragraph of that section, and then adding the new section as the current section.
|
|
411
|
+
* When that section doesn't end with a paragraph of its own (it ends with a table, or
|
|
412
|
+
* it is empty), an empty paragraph is added to hold its properties.
|
|
408
413
|
*
|
|
409
414
|
* According to the OOXML specification:
|
|
410
415
|
* - Section properties for all sections except the last must be stored in a paragraph's
|
|
@@ -418,7 +423,11 @@ declare class Body_2 extends XmlComponent {
|
|
|
418
423
|
* Prepares the body element for XML serialization.
|
|
419
424
|
*
|
|
420
425
|
* Ensures that the last section's properties are placed as a direct child of the body
|
|
421
|
-
* element, as required by the OOXML specification.
|
|
426
|
+
* element, as required by the OOXML specification. Once the body is written, its tables
|
|
427
|
+
* of contents are filled in from its headings, and, when the body has a page number
|
|
428
|
+
* estimator, its page references are given their page numbers. Its SEQ fields are given
|
|
429
|
+
* their numbers after the tables of contents are filled in, as Word leaves a heading's SEQ
|
|
430
|
+
* number out of its entry.
|
|
422
431
|
*
|
|
423
432
|
* @param context - The XML serialization context
|
|
424
433
|
* @returns The prepared XML object or undefined
|
|
@@ -433,6 +442,18 @@ declare class Body_2 extends XmlComponent {
|
|
|
433
442
|
* @param component - The XML component to add (paragraph, table, etc.)
|
|
434
443
|
*/
|
|
435
444
|
push(component: XmlComponent): void;
|
|
445
|
+
/**
|
|
446
|
+
* The paragraph the current section ends with, which can hold its properties.
|
|
447
|
+
*
|
|
448
|
+
* There is none when the section ends with something other than a paragraph, or is empty:
|
|
449
|
+
* its last child is then the placeholder at the start of the body (removed when the body is
|
|
450
|
+
* written) or the paragraph that ends the section before, which has properties of its own.
|
|
451
|
+
*/
|
|
452
|
+
private lastParagraphOfSection;
|
|
453
|
+
/**
|
|
454
|
+
* An empty paragraph to end a section that has no paragraph of its own to end it. The section's
|
|
455
|
+
* properties are written into it with the others, when the body is written.
|
|
456
|
+
*/
|
|
436
457
|
private createSectionParagraph;
|
|
437
458
|
}
|
|
438
459
|
export { Body_2 as Body }
|
|
@@ -482,13 +503,21 @@ export declare class Bookmark {
|
|
|
482
503
|
readonly children: readonly ParagraphChild[];
|
|
483
504
|
readonly end: BookmarkEnd;
|
|
484
505
|
constructor(options: IBookmarkOptions);
|
|
506
|
+
/**
|
|
507
|
+
* The components written in this bookmark's place: its start, its children and its end. A bookmark in its
|
|
508
|
+
* children is written the same way, so one bookmark can hold another.
|
|
509
|
+
*
|
|
510
|
+
* @internal
|
|
511
|
+
*/
|
|
512
|
+
get writtenAs(): readonly (ParagraphChild | BookmarkStart | BookmarkEnd)[];
|
|
485
513
|
}
|
|
486
514
|
|
|
487
515
|
/**
|
|
488
516
|
* Represents the end marker of a bookmark range.
|
|
489
517
|
*
|
|
490
518
|
* This element marks the end of a bookmarked region in the document.
|
|
491
|
-
* It must be paired with a corresponding BookmarkStart element with the same id
|
|
519
|
+
* It must be paired with a corresponding BookmarkStart element with the same id,
|
|
520
|
+
* taken from `bookmarkUniqueNumericId` (see `BookmarkStart`).
|
|
492
521
|
*
|
|
493
522
|
* Reference: http://officeopenxml.com/WPbookmark.php
|
|
494
523
|
*
|
|
@@ -507,7 +536,9 @@ export declare class Bookmark {
|
|
|
507
536
|
*
|
|
508
537
|
* @example
|
|
509
538
|
* ```typescript
|
|
510
|
-
*
|
|
539
|
+
* const id = bookmarkUniqueNumericId();
|
|
540
|
+
* new BookmarkStart("myBookmark", id);
|
|
541
|
+
* new BookmarkEnd(id);
|
|
511
542
|
* ```
|
|
512
543
|
*/
|
|
513
544
|
export declare class BookmarkEnd extends XmlComponent {
|
|
@@ -520,6 +551,10 @@ export declare class BookmarkEnd extends XmlComponent {
|
|
|
520
551
|
* This element marks the beginning of a bookmarked region in the document.
|
|
521
552
|
* It must be paired with a corresponding BookmarkEnd element with the same id.
|
|
522
553
|
*
|
|
554
|
+
* The id must be unique in the document. `Bookmark` takes its ids from
|
|
555
|
+
* `bookmarkUniqueNumericId`, so take this one from it too, or it can be the
|
|
556
|
+
* same as a `Bookmark`'s.
|
|
557
|
+
*
|
|
523
558
|
* Reference: http://officeopenxml.com/WPbookmark.php
|
|
524
559
|
*
|
|
525
560
|
* ## XSD Schema
|
|
@@ -537,7 +572,10 @@ export declare class BookmarkEnd extends XmlComponent {
|
|
|
537
572
|
*
|
|
538
573
|
* @example
|
|
539
574
|
* ```typescript
|
|
540
|
-
*
|
|
575
|
+
* // A bookmark across two paragraphs
|
|
576
|
+
* const id = bookmarkUniqueNumericId();
|
|
577
|
+
* new Paragraph({ children: [new BookmarkStart("myBookmark", id), new TextRun("First")] });
|
|
578
|
+
* new Paragraph({ children: [new TextRun("Last"), new BookmarkEnd(id)] });
|
|
541
579
|
* ```
|
|
542
580
|
*/
|
|
543
581
|
export declare class BookmarkStart extends XmlComponent {
|
|
@@ -1181,6 +1219,11 @@ export declare class Comments extends XmlComponent {
|
|
|
1181
1219
|
get CommentIdsData(): readonly ICommentIdData[] | undefined;
|
|
1182
1220
|
/** Whether there are no comments, in which case the document has no comments.xml part. */
|
|
1183
1221
|
get IsEmpty(): boolean;
|
|
1222
|
+
/**
|
|
1223
|
+
* Formats the comments, with the page numbers worked out for their document written into their fields, when the
|
|
1224
|
+
* document's body is written with an estimate of its pages.
|
|
1225
|
+
*/
|
|
1226
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
1184
1227
|
}
|
|
1185
1228
|
|
|
1186
1229
|
/**
|
|
@@ -1264,7 +1307,26 @@ declare const CompoundLine: {
|
|
|
1264
1307
|
*/
|
|
1265
1308
|
export declare class ConcreteHyperlink extends XmlComponent {
|
|
1266
1309
|
readonly linkId: string;
|
|
1267
|
-
|
|
1310
|
+
private readonly drawingLink?;
|
|
1311
|
+
/**
|
|
1312
|
+
* @param children - Inline content of the hyperlink
|
|
1313
|
+
* @param relationshipId - Id of the external relationship, without the rId prefix
|
|
1314
|
+
* @param anchor - Bookmark name or external URL fragment
|
|
1315
|
+
* @param externalLink - The full address of an external hyperlink, so the relationship id is kept alongside its anchor
|
|
1316
|
+
*/
|
|
1317
|
+
constructor(children: readonly ParagraphChild[], relationshipId: string, anchor?: string, externalLink?: string);
|
|
1318
|
+
/**
|
|
1319
|
+
* Creates the `a:hlinkClick` of a picture in the hyperlink, which links to the same address.
|
|
1320
|
+
*
|
|
1321
|
+
* The hyperlink decides which relationship its pictures use, rather than the pictures reading `linkId`, because only it
|
|
1322
|
+
* knows whether that relationship has lost the fragment to `w:anchor`. The picture's relationship is added as the
|
|
1323
|
+
* picture is written, through the context's relationships, so it lands in the part the picture is in, both when
|
|
1324
|
+
* packing and when patching.
|
|
1325
|
+
*
|
|
1326
|
+
* @param context - The context the picture is written in, whose relationships get the picture's link if it has its own
|
|
1327
|
+
* @param declareNamespace - Declares the DrawingML namespace, for elements outside `a:graphic` such as `wp:docPr`
|
|
1328
|
+
*/
|
|
1329
|
+
createDrawingClick(context: IContext, declareNamespace: boolean): XmlComponent;
|
|
1268
1330
|
}
|
|
1269
1331
|
|
|
1270
1332
|
/**
|
|
@@ -1462,7 +1524,7 @@ declare type CoreGroupOptions = {
|
|
|
1462
1524
|
* it: use it instead of alternative text for images that carry no information, such as borders and flourishes.
|
|
1463
1525
|
*/
|
|
1464
1526
|
declare type CoreImageOptions = DrawingLinkOptions & {
|
|
1465
|
-
/** Size, position, rotation, and flip settings for the image. Width and height are
|
|
1527
|
+
/** Size, position, rotation, and flip settings for the image. Width and height are in pixels, at 96 to the inch, not EMUs. */
|
|
1466
1528
|
readonly transformation: IMediaTransformation;
|
|
1467
1529
|
/** Floating layout options. When set, the image is positioned freely on the page rather than inline with text. Controls text wrapping, overlap, anchoring, and z-order. */
|
|
1468
1530
|
readonly floating?: IFloating;
|
|
@@ -1691,6 +1753,57 @@ export declare const createDotEmphasisMark: () => XmlComponent;
|
|
|
1691
1753
|
*/
|
|
1692
1754
|
export declare const createEmphasisMark: (emphasisMarkType?: (typeof EmphasisMarkType)[keyof typeof EmphasisMarkType]) => XmlComponent;
|
|
1693
1755
|
|
|
1756
|
+
/**
|
|
1757
|
+
* Creates the endnote properties (endnotePr) of a section.
|
|
1758
|
+
*
|
|
1759
|
+
* ## XSD Schema
|
|
1760
|
+
* ```xml
|
|
1761
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
1762
|
+
* <xsd:sequence>
|
|
1763
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
1764
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
1765
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
1766
|
+
* </xsd:sequence>
|
|
1767
|
+
* </xsd:complexType>
|
|
1768
|
+
* ```
|
|
1769
|
+
*
|
|
1770
|
+
* @example
|
|
1771
|
+
* ```typescript
|
|
1772
|
+
* // Endnotes at the end of the document, numbered 001, 002, 003
|
|
1773
|
+
* createEndnoteProperties({
|
|
1774
|
+
* position: EndnotePosition.DOCUMENT_END,
|
|
1775
|
+
* numberFormat: { type: NumberFormat.CUSTOM, format: "001" },
|
|
1776
|
+
* });
|
|
1777
|
+
* ```
|
|
1778
|
+
*/
|
|
1779
|
+
export declare const createEndnoteProperties: (options: IEndnotePropertiesOptions) => XmlComponent;
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Creates the footnote properties (footnotePr) of a section.
|
|
1783
|
+
*
|
|
1784
|
+
* ## XSD Schema
|
|
1785
|
+
* ```xml
|
|
1786
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
1787
|
+
* <xsd:sequence>
|
|
1788
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
1789
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
1790
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
1791
|
+
* </xsd:sequence>
|
|
1792
|
+
* </xsd:complexType>
|
|
1793
|
+
* ```
|
|
1794
|
+
*
|
|
1795
|
+
* @example
|
|
1796
|
+
* ```typescript
|
|
1797
|
+
* // Footnotes at the end of the section, numbered a, b, c and restarting in each section
|
|
1798
|
+
* createFootnoteProperties({
|
|
1799
|
+
* position: FootnotePosition.SECTION_END,
|
|
1800
|
+
* numberFormat: { type: NumberFormat.LOWER_LETTER },
|
|
1801
|
+
* restart: NoteNumberRestart.EACH_SECTION,
|
|
1802
|
+
* });
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
export declare const createFootnoteProperties: (options: IFootnotePropertiesOptions) => XmlComponent;
|
|
1806
|
+
|
|
1694
1807
|
/**
|
|
1695
1808
|
* Creates a frame properties XML component for paragraph text frames.
|
|
1696
1809
|
*
|
|
@@ -2123,7 +2236,7 @@ export declare const createPageMargin: (top: number | UniversalMeasure, right: n
|
|
|
2123
2236
|
* });
|
|
2124
2237
|
* ```
|
|
2125
2238
|
*/
|
|
2126
|
-
export declare const createPageNumberType: ({ start, formatType, separator }: IPageNumberTypeAttributes) => XmlComponent;
|
|
2239
|
+
export declare const createPageNumberType: ({ start, formatType, separator, chapterHeadingLevel }: IPageNumberTypeAttributes) => XmlComponent;
|
|
2127
2240
|
|
|
2128
2241
|
/**
|
|
2129
2242
|
* This element specifies the properties (size and orientation) for all pages in the current section.
|
|
@@ -3371,6 +3484,23 @@ export declare type EffectExtentAttributes = {
|
|
|
3371
3484
|
*/
|
|
3372
3485
|
export declare const eighthPointMeasureValue: (val: number) => number;
|
|
3373
3486
|
|
|
3487
|
+
/**
|
|
3488
|
+
* A font file the document embeds: one face of one of its fonts, with the unique key it is obfuscated with.
|
|
3489
|
+
*
|
|
3490
|
+
* @property name - Font family name
|
|
3491
|
+
* @property data - Font file data of the face
|
|
3492
|
+
* @property bold - Whether the face is bold
|
|
3493
|
+
* @property italic - Whether the face is italic
|
|
3494
|
+
* @property fontKey - Unique key (GUID) the file is obfuscated with
|
|
3495
|
+
*/
|
|
3496
|
+
declare type EmbeddedFontFile = {
|
|
3497
|
+
readonly name: string;
|
|
3498
|
+
readonly data: Buffer;
|
|
3499
|
+
readonly bold: boolean;
|
|
3500
|
+
readonly italic: boolean;
|
|
3501
|
+
readonly fontKey: string;
|
|
3502
|
+
};
|
|
3503
|
+
|
|
3374
3504
|
/**
|
|
3375
3505
|
* A file of a package that is embedded in the document, such as a sheet of an embedded workbook.
|
|
3376
3506
|
*/
|
|
@@ -3456,6 +3586,28 @@ export declare class EndnoteIdReference extends XmlComponent {
|
|
|
3456
3586
|
constructor(id: number);
|
|
3457
3587
|
}
|
|
3458
3588
|
|
|
3589
|
+
/**
|
|
3590
|
+
* Where the endnotes of a section are placed.
|
|
3591
|
+
*
|
|
3592
|
+
* ## XSD Schema
|
|
3593
|
+
* ```xml
|
|
3594
|
+
* <xsd:simpleType name="ST_EdnPos">
|
|
3595
|
+
* <xsd:restriction base="xsd:string">
|
|
3596
|
+
* <xsd:enumeration value="sectEnd"/>
|
|
3597
|
+
* <xsd:enumeration value="docEnd"/>
|
|
3598
|
+
* </xsd:restriction>
|
|
3599
|
+
* </xsd:simpleType>
|
|
3600
|
+
* ```
|
|
3601
|
+
*
|
|
3602
|
+
* @publicApi
|
|
3603
|
+
*/
|
|
3604
|
+
export declare const EndnotePosition: {
|
|
3605
|
+
/** At the end of the section */
|
|
3606
|
+
readonly SECTION_END: "sectEnd";
|
|
3607
|
+
/** At the end of the document */
|
|
3608
|
+
readonly DOCUMENT_END: "docEnd";
|
|
3609
|
+
};
|
|
3610
|
+
|
|
3459
3611
|
/**
|
|
3460
3612
|
* Represents a reference to an endnote.
|
|
3461
3613
|
*
|
|
@@ -3480,6 +3632,11 @@ export declare class EndnoteReferenceRunAttributes extends XmlAttributeComponent
|
|
|
3480
3632
|
export declare class Endnotes extends XmlComponent {
|
|
3481
3633
|
constructor();
|
|
3482
3634
|
createEndnote(id: number, paragraph: readonly Paragraph[]): void;
|
|
3635
|
+
/**
|
|
3636
|
+
* Formats the endnotes, with the page numbers worked out for their document written into their fields, when the
|
|
3637
|
+
* document's body is written with an estimate of its pages.
|
|
3638
|
+
*/
|
|
3639
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
3483
3640
|
}
|
|
3484
3641
|
|
|
3485
3642
|
declare class EndnotesWrapper implements IViewWrapper {
|
|
@@ -3490,12 +3647,57 @@ declare class EndnotesWrapper implements IViewWrapper {
|
|
|
3490
3647
|
get Relationships(): Relationships;
|
|
3491
3648
|
}
|
|
3492
3649
|
|
|
3650
|
+
/**
|
|
3651
|
+
* The page each bookmark of a document starts on, and the number of pages of the document and of each of its sections,
|
|
3652
|
+
* as a {@link PageNumberEstimator} works them out.
|
|
3653
|
+
*
|
|
3654
|
+
* @publicApi
|
|
3655
|
+
*/
|
|
3656
|
+
export declare type EstimatedPageNumbers = {
|
|
3657
|
+
/**
|
|
3658
|
+
* The number of the page each bookmark starts on, as the page shows it, such as `"3"` or `"iv"`, by the bookmark's
|
|
3659
|
+
* name. The page references to a bookmark that isn't in it are left blank.
|
|
3660
|
+
*/
|
|
3661
|
+
readonly bookmarks: ReadonlyMap<string, string>;
|
|
3662
|
+
/** The number of pages of the document, which its NUMPAGES fields show. They are left blank without it */
|
|
3663
|
+
readonly pageCount?: number;
|
|
3664
|
+
/**
|
|
3665
|
+
* The number of pages of each of the document's sections, in order, which the SECTIONPAGES fields in the section, and
|
|
3666
|
+
* in headers and footers only on its pages, show. Those of a section whose number is undefined are left blank.
|
|
3667
|
+
*/
|
|
3668
|
+
readonly sectionPageCounts?: readonly (number | undefined)[];
|
|
3669
|
+
/**
|
|
3670
|
+
* The number of the page each bookmark starts on, as a number, such as 4, by the bookmark's name, which the page
|
|
3671
|
+
* references to it with a number format of their own write in that format: `PAGEREF Results \* roman` writes "iv".
|
|
3672
|
+
* Those to a bookmark that isn't in it are left blank.
|
|
3673
|
+
*/
|
|
3674
|
+
readonly bookmarkPageNumbers?: ReadonlyMap<string, number>;
|
|
3675
|
+
/**
|
|
3676
|
+
* What each page reference with `\p` (`useRelativePosition`) in the body writes, by the name of the bookmark it
|
|
3677
|
+
* refers to, in the order they are in the body: "above" or "below" when it is on the same page as the bookmark, and
|
|
3678
|
+
* "on page" and the bookmark's page otherwise, such as "on page 4". Those it has nothing for are left blank, as are
|
|
3679
|
+
* those in headers, footers and notes.
|
|
3680
|
+
*/
|
|
3681
|
+
readonly relativePositions?: ReadonlyMap<string, readonly (string | undefined)[]>;
|
|
3682
|
+
/**
|
|
3683
|
+
* Where the estimator guessed, when it was asked to lay out past what it can't lay out as Word does, as
|
|
3684
|
+
* `estimatePageNumbersWith({ guess: true })` from `docx/layout` is, in the order of the pages. The page numbers from
|
|
3685
|
+
* the first of them on may not be Word's. Nothing of them is written into the document.
|
|
3686
|
+
*/
|
|
3687
|
+
readonly guesses?: readonly PageNumberGuess[];
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3493
3690
|
/**
|
|
3494
3691
|
* Represents an external hyperlink to a URL outside the document.
|
|
3495
3692
|
*
|
|
3496
3693
|
* External hyperlinks create a relationship to an external resource (URL).
|
|
3497
3694
|
* The relationship is created during document preparation and the hyperlink
|
|
3498
3695
|
* is converted to a ConcreteHyperlink with the relationship ID.
|
|
3696
|
+
* URL fragments of at most 255 UTF-16 units are written as anchors, preserving any additional # characters.
|
|
3697
|
+
* Longer fragments stay in the original relationship URI to avoid exceeding Word's anchor limit;
|
|
3698
|
+
* those links retain the existing limitations for fragments with multiple # characters.
|
|
3699
|
+
* Word appends the anchor to the relationship target as described in MS-OI29500 §17.16.22:
|
|
3700
|
+
* https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/df06e423-11a6-4a36-bfb3-82139e531781
|
|
3499
3701
|
*
|
|
3500
3702
|
* Reference: http://officeopenxml.com/WPhyperlink.php
|
|
3501
3703
|
*
|
|
@@ -3509,6 +3711,7 @@ declare class EndnotesWrapper implements IViewWrapper {
|
|
|
3509
3711
|
* <xsd:group ref="EG_PContent" minOccurs="0" maxOccurs="unbounded"/>
|
|
3510
3712
|
* <xsd:attribute ref="r:id"/>
|
|
3511
3713
|
* <xsd:attribute name="history" type="s:ST_OnOff" use="optional"/>
|
|
3714
|
+
* <xsd:attribute name="anchor" type="s:ST_String" use="optional"/>
|
|
3512
3715
|
* </xsd:complexType>
|
|
3513
3716
|
* ```
|
|
3514
3717
|
*
|
|
@@ -3713,20 +3916,54 @@ declare type FilePatch = {
|
|
|
3713
3916
|
readonly children: readonly FileChild[];
|
|
3714
3917
|
};
|
|
3715
3918
|
|
|
3919
|
+
/**
|
|
3920
|
+
* Writes the page numbers the estimator works out into the fields of a formatted body that show them: the PAGEREF fields
|
|
3921
|
+
* in its tables of contents and elsewhere, those with `\p` and in number formats of their own, and its NUMPAGES and
|
|
3922
|
+
* SECTIONPAGES fields. A field whose number the estimator didn't work out is left as it is. Page references and tables
|
|
3923
|
+
* of contents are written clean, whether or not their numbers were worked out. The estimate is kept for the document's
|
|
3924
|
+
* headers and footers.
|
|
3925
|
+
*/
|
|
3926
|
+
export declare const fillPageNumbers: (body: IXmlableObject, context: IContext, estimator: PageNumberEstimator) => void;
|
|
3927
|
+
|
|
3928
|
+
/**
|
|
3929
|
+
* Writes the page numbers worked out for the document a header, footer, footnote, endnote or comment is in into the
|
|
3930
|
+
* fields of the formatted part that show them, once the document's body is written. Its page references and SEQ fields
|
|
3931
|
+
* are written clean, and its SEQ fields are left blank: Word writes them as an error, "Error! Main Document Only.".
|
|
3932
|
+
*
|
|
3933
|
+
* @param part - The formatted part, if it has anything to write
|
|
3934
|
+
* @param context - The context it was formatted in, with the document it is in
|
|
3935
|
+
* @param referenceId - The number of the relationship to a header or footer. The SECTIONPAGES fields of the other parts
|
|
3936
|
+
* are left as they are
|
|
3937
|
+
*/
|
|
3938
|
+
export declare const fillPartPageNumbers: (part: IXmlableObject | undefined, context: IContext, referenceId?: number) => void;
|
|
3939
|
+
|
|
3940
|
+
/**
|
|
3941
|
+
* Writes the numbers of the SEQ fields of a formatted body into them, counted as Word counts them (see
|
|
3942
|
+
* {@link sequenceNumbering}), and writes them clean, whether or not their numbers were worked out. It is done after its
|
|
3943
|
+
* tables of contents are filled in from its headings, as Word leaves a heading's SEQ number out of its entry.
|
|
3944
|
+
*/
|
|
3945
|
+
export declare const fillSequenceNumbers: (body: IXmlableObject, context: IContext) => void;
|
|
3946
|
+
|
|
3716
3947
|
/**
|
|
3717
3948
|
* Options for embedding a font in the document.
|
|
3718
3949
|
*/
|
|
3719
3950
|
declare type FontOptions = {
|
|
3720
3951
|
/** Font family name */
|
|
3721
3952
|
readonly name: string;
|
|
3722
|
-
/** Font file data (TTF, OTF, etc.) */
|
|
3953
|
+
/** Font file data (TTF, OTF, etc.) of the regular face */
|
|
3723
3954
|
readonly data: Buffer;
|
|
3955
|
+
/** Font file data of the bold face, embedded as `w:embedBold` */
|
|
3956
|
+
readonly bold?: Buffer;
|
|
3957
|
+
/** Font file data of the italic face, embedded as `w:embedItalic` */
|
|
3958
|
+
readonly italic?: Buffer;
|
|
3959
|
+
/** Font file data of the bold italic face, embedded as `w:embedBoldItalic` */
|
|
3960
|
+
readonly boldItalic?: Buffer;
|
|
3724
3961
|
/** Character set/encoding for the font */
|
|
3725
3962
|
readonly characterSet?: (typeof CharacterSet)[keyof typeof CharacterSet];
|
|
3726
3963
|
};
|
|
3727
3964
|
|
|
3728
3965
|
/**
|
|
3729
|
-
* Font options extended with
|
|
3966
|
+
* Font options extended with the unique key of the regular face's file.
|
|
3730
3967
|
*/
|
|
3731
3968
|
declare type FontOptionsWithKey = FontOptions & {
|
|
3732
3969
|
readonly fontKey: string;
|
|
@@ -3736,12 +3973,13 @@ declare type FontOptionsWithKey = FontOptions & {
|
|
|
3736
3973
|
* Wrapper class for managing the font table and its relationships.
|
|
3737
3974
|
*
|
|
3738
3975
|
* Creates a font table with embedded font files and manages the relationships
|
|
3739
|
-
* required for font embedding. Each font is
|
|
3976
|
+
* required for font embedding. Each face of a font is embedded as a file of its own,
|
|
3977
|
+
* with a unique key for obfuscation.
|
|
3740
3978
|
*
|
|
3741
3979
|
* @example
|
|
3742
3980
|
* ```typescript
|
|
3743
3981
|
* const fontWrapper = new FontWrapper([
|
|
3744
|
-
* { name: "CustomFont", data: fontBuffer }
|
|
3982
|
+
* { name: "CustomFont", data: fontBuffer, bold: boldFontBuffer }
|
|
3745
3983
|
* ]);
|
|
3746
3984
|
* ```
|
|
3747
3985
|
*/
|
|
@@ -3749,7 +3987,10 @@ declare class FontWrapper implements IViewWrapper {
|
|
|
3749
3987
|
readonly options: readonly FontOptions[];
|
|
3750
3988
|
private readonly fontTable;
|
|
3751
3989
|
private readonly relationships;
|
|
3990
|
+
/** @deprecated Use `files`, which has the file and key of each face a font embeds, not only the regular face's key */
|
|
3752
3991
|
readonly fontOptionsWithKey: readonly FontOptionsWithKey[];
|
|
3992
|
+
/** The files of the faces the fonts embed, in order: the Nth is `fonts/font<N>.odttf`, with the relationship `rId<N>` */
|
|
3993
|
+
readonly files: readonly EmbeddedFontFile[];
|
|
3753
3994
|
constructor(options: readonly FontOptions[]);
|
|
3754
3995
|
get View(): XmlComponent;
|
|
3755
3996
|
get Relationships(): Relationships;
|
|
@@ -3820,6 +4061,11 @@ declare class Footer_2 extends InitializableXmlComponent {
|
|
|
3820
4061
|
constructor(referenceNumber: number, initContent?: XmlComponent);
|
|
3821
4062
|
get ReferenceId(): number;
|
|
3822
4063
|
add(item: Paragraph | Table): void;
|
|
4064
|
+
/**
|
|
4065
|
+
* Formats the footer, with the page numbers worked out for its document written into its fields, when the document's
|
|
4066
|
+
* body is written with an estimate of its pages.
|
|
4067
|
+
*/
|
|
4068
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
3823
4069
|
}
|
|
3824
4070
|
|
|
3825
4071
|
/**
|
|
@@ -3852,6 +4098,34 @@ export declare class FooterWrapper implements IViewWrapper {
|
|
|
3852
4098
|
get Media(): Media;
|
|
3853
4099
|
}
|
|
3854
4100
|
|
|
4101
|
+
/**
|
|
4102
|
+
* Where the footnotes of a section are placed.
|
|
4103
|
+
*
|
|
4104
|
+
* ## XSD Schema
|
|
4105
|
+
* ```xml
|
|
4106
|
+
* <xsd:simpleType name="ST_FtnPos">
|
|
4107
|
+
* <xsd:restriction base="xsd:string">
|
|
4108
|
+
* <xsd:enumeration value="pageBottom"/>
|
|
4109
|
+
* <xsd:enumeration value="beneathText"/>
|
|
4110
|
+
* <xsd:enumeration value="sectEnd"/>
|
|
4111
|
+
* <xsd:enumeration value="docEnd"/>
|
|
4112
|
+
* </xsd:restriction>
|
|
4113
|
+
* </xsd:simpleType>
|
|
4114
|
+
* ```
|
|
4115
|
+
*
|
|
4116
|
+
* @publicApi
|
|
4117
|
+
*/
|
|
4118
|
+
export declare const FootnotePosition: {
|
|
4119
|
+
/** At the bottom of each page */
|
|
4120
|
+
readonly PAGE_BOTTOM: "pageBottom";
|
|
4121
|
+
/** Directly below the text on each page */
|
|
4122
|
+
readonly BENEATH_TEXT: "beneathText";
|
|
4123
|
+
/** At the end of the section */
|
|
4124
|
+
readonly SECTION_END: "sectEnd";
|
|
4125
|
+
/** At the end of the document */
|
|
4126
|
+
readonly DOCUMENT_END: "docEnd";
|
|
4127
|
+
};
|
|
4128
|
+
|
|
3855
4129
|
/**
|
|
3856
4130
|
* Represents a footnote reference element in WordprocessingML.
|
|
3857
4131
|
*
|
|
@@ -3977,6 +4251,11 @@ export declare class FootNotes extends XmlComponent {
|
|
|
3977
4251
|
* @param paragraph - Array of paragraphs that make up the footnote content
|
|
3978
4252
|
*/
|
|
3979
4253
|
createFootNote(id: number, paragraph: readonly Paragraph[]): void;
|
|
4254
|
+
/**
|
|
4255
|
+
* Formats the footnotes, with the page numbers worked out for their document written into their fields, when the
|
|
4256
|
+
* document's body is written with an estimate of its pages.
|
|
4257
|
+
*/
|
|
4258
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
3980
4259
|
}
|
|
3981
4260
|
|
|
3982
4261
|
/**
|
|
@@ -4168,6 +4447,11 @@ declare class Header_2 extends InitializableXmlComponent {
|
|
|
4168
4447
|
constructor(referenceNumber: number, initContent?: XmlComponent);
|
|
4169
4448
|
get ReferenceId(): number;
|
|
4170
4449
|
add(item: Paragraph | Table): void;
|
|
4450
|
+
/**
|
|
4451
|
+
* Formats the header, with the page numbers worked out for its document written into its fields, when the document's
|
|
4452
|
+
* body is written with an estimate of its pages.
|
|
4453
|
+
*/
|
|
4454
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
4171
4455
|
}
|
|
4172
4456
|
|
|
4173
4457
|
/**
|
|
@@ -4596,10 +4880,10 @@ declare type IBaseFrameOptions = {
|
|
|
4596
4880
|
readonly anchorLock?: boolean;
|
|
4597
4881
|
/** Drop cap effect type */
|
|
4598
4882
|
readonly dropCap?: (typeof DropCapType)[keyof typeof DropCapType];
|
|
4599
|
-
/** Frame width in twips */
|
|
4600
|
-
readonly width
|
|
4601
|
-
/** Frame height in twips */
|
|
4602
|
-
readonly height
|
|
4883
|
+
/** Frame width in twips. When omitted, the frame is as wide as its content. */
|
|
4884
|
+
readonly width?: number;
|
|
4885
|
+
/** Frame height in twips. When omitted, the frame is as tall as its content. */
|
|
4886
|
+
readonly height?: number;
|
|
4603
4887
|
/** Text wrapping behavior around the frame */
|
|
4604
4888
|
readonly wrap?: (typeof FrameWrap)[keyof typeof FrameWrap];
|
|
4605
4889
|
/** Number of lines for drop cap effect */
|
|
@@ -4635,6 +4919,14 @@ export declare type IBaseParagraphStyleOptions = {
|
|
|
4635
4919
|
readonly run?: IRunStylePropertiesOptions;
|
|
4636
4920
|
} & IStyleOptions;
|
|
4637
4921
|
|
|
4922
|
+
/**
|
|
4923
|
+
* Options for the body of a document.
|
|
4924
|
+
*/
|
|
4925
|
+
export declare type IBodyOptions = {
|
|
4926
|
+
/** Works out the page each bookmark is on, to write the page numbers of page references. See {@link PageNumberEstimator} */
|
|
4927
|
+
readonly pageNumbers?: PageNumberEstimator;
|
|
4928
|
+
};
|
|
4929
|
+
|
|
4638
4930
|
export declare type IBodyPropertiesOptions = {
|
|
4639
4931
|
readonly wrap?: (typeof TextWrappingType)[keyof typeof TextWrappingType];
|
|
4640
4932
|
readonly verticalAnchor?: VerticalAnchor;
|
|
@@ -5280,12 +5572,15 @@ export declare type IDocumentHeader = {
|
|
|
5280
5572
|
* Options for creating a Document element.
|
|
5281
5573
|
*
|
|
5282
5574
|
* @property background - Optional background settings for the document
|
|
5575
|
+
* @property pageNumbers - Works out the page each bookmark is on, to write the page numbers of page references
|
|
5283
5576
|
*
|
|
5284
5577
|
* @see {@link Document}
|
|
5285
5578
|
*/
|
|
5286
5579
|
export declare type IDocumentOptions = {
|
|
5287
5580
|
/** Optional background settings for the document */
|
|
5288
5581
|
readonly background?: IDocumentBackgroundOptions;
|
|
5582
|
+
/** Works out the page each bookmark is on, to write the page numbers of page references. See {@link PageNumberEstimator} */
|
|
5583
|
+
readonly pageNumbers?: PageNumberEstimator;
|
|
5289
5584
|
};
|
|
5290
5585
|
|
|
5291
5586
|
/**
|
|
@@ -5303,6 +5598,19 @@ export declare type IDrawingOptions = DrawingLinkOptions & {
|
|
|
5303
5598
|
readonly effectExtent?: EffectExtentAttributes;
|
|
5304
5599
|
};
|
|
5305
5600
|
|
|
5601
|
+
/**
|
|
5602
|
+
* Endnote settings of a section.
|
|
5603
|
+
*
|
|
5604
|
+
* @property position - Where the endnotes are placed
|
|
5605
|
+
* @property numberFormat - Number format of the endnotes
|
|
5606
|
+
* @property start - Number of the first endnote
|
|
5607
|
+
* @property restart - When the numbering restarts
|
|
5608
|
+
*/
|
|
5609
|
+
export declare type IEndnotePropertiesOptions = INotePropertiesBaseOptions & {
|
|
5610
|
+
/** Where the endnotes are placed */
|
|
5611
|
+
readonly position?: (typeof EndnotePosition)[keyof typeof EndnotePosition];
|
|
5612
|
+
};
|
|
5613
|
+
|
|
5306
5614
|
export declare type IExtendedMediaData = IMediaData | WpsMediaData | WpgMediaData | GraphicMediaData;
|
|
5307
5615
|
|
|
5308
5616
|
/**
|
|
@@ -5362,6 +5670,19 @@ declare type IFontOptions = {
|
|
|
5362
5670
|
readonly hint?: string;
|
|
5363
5671
|
};
|
|
5364
5672
|
|
|
5673
|
+
/**
|
|
5674
|
+
* Footnote settings of a section.
|
|
5675
|
+
*
|
|
5676
|
+
* @property position - Where the footnotes are placed
|
|
5677
|
+
* @property numberFormat - Number format of the footnotes
|
|
5678
|
+
* @property start - Number of the first footnote
|
|
5679
|
+
* @property restart - When the numbering restarts
|
|
5680
|
+
*/
|
|
5681
|
+
export declare type IFootnotePropertiesOptions = INotePropertiesBaseOptions & {
|
|
5682
|
+
/** Where the footnotes are placed */
|
|
5683
|
+
readonly position?: (typeof FootnotePosition)[keyof typeof FootnotePosition];
|
|
5684
|
+
};
|
|
5685
|
+
|
|
5365
5686
|
/**
|
|
5366
5687
|
* Union type for all frame positioning options.
|
|
5367
5688
|
*
|
|
@@ -5945,8 +6266,9 @@ export declare type IMediaTransformation = {
|
|
|
5945
6266
|
readonly top?: number;
|
|
5946
6267
|
readonly left?: number;
|
|
5947
6268
|
};
|
|
6269
|
+
/** Display width in pixels, at 96 to the inch, not EMUs. Word won't open a drawing more than 225457 pixels wide */
|
|
5948
6270
|
readonly width: number;
|
|
5949
|
-
/** Display height in pixels */
|
|
6271
|
+
/** Display height in pixels, at 96 to the inch, not EMUs. Word won't open a drawing more than 225457 pixels tall */
|
|
5950
6272
|
readonly height: number;
|
|
5951
6273
|
/** Optional flip transformations */
|
|
5952
6274
|
readonly flip?: {
|
|
@@ -6080,6 +6402,28 @@ declare type INonVisualShapePropertiesOptions = {
|
|
|
6080
6402
|
readonly txBox: string;
|
|
6081
6403
|
};
|
|
6082
6404
|
|
|
6405
|
+
/**
|
|
6406
|
+
* Number format of the footnotes or endnotes of a section.
|
|
6407
|
+
*
|
|
6408
|
+
* @property type - Number format (decimal, roman, letter, etc.)
|
|
6409
|
+
* @property format - Pattern used with `NumberFormat.CUSTOM`, such as "001"
|
|
6410
|
+
*/
|
|
6411
|
+
export declare type INoteNumberFormatOptions = {
|
|
6412
|
+
/** Number format (decimal, roman, letter, etc.) */
|
|
6413
|
+
readonly type: (typeof NumberFormat)[keyof typeof NumberFormat];
|
|
6414
|
+
/** Pattern used with `NumberFormat.CUSTOM`, such as "001" */
|
|
6415
|
+
readonly format?: string;
|
|
6416
|
+
};
|
|
6417
|
+
|
|
6418
|
+
declare type INotePropertiesBaseOptions = {
|
|
6419
|
+
/** Number format of the notes */
|
|
6420
|
+
readonly numberFormat?: INoteNumberFormatOptions;
|
|
6421
|
+
/** Number of the first note */
|
|
6422
|
+
readonly start?: number;
|
|
6423
|
+
/** When the numbering restarts */
|
|
6424
|
+
readonly restart?: (typeof NoteNumberRestart)[keyof typeof NoteNumberRestart];
|
|
6425
|
+
};
|
|
6426
|
+
|
|
6083
6427
|
/**
|
|
6084
6428
|
* Supported input data types for document patching.
|
|
6085
6429
|
*
|
|
@@ -6296,6 +6640,7 @@ export declare type IPageMarginAttributes = {
|
|
|
6296
6640
|
* @property start - Starting page number for the section
|
|
6297
6641
|
* @property formatType - Number format (decimal, roman, letter, etc.)
|
|
6298
6642
|
* @property separator - Separator between chapter and page number
|
|
6643
|
+
* @property chapterHeadingLevel - The level of the headings whose numbers are the chapter numbers
|
|
6299
6644
|
*/
|
|
6300
6645
|
export declare type IPageNumberTypeAttributes = {
|
|
6301
6646
|
/** Starting page number for the section */
|
|
@@ -6304,6 +6649,12 @@ export declare type IPageNumberTypeAttributes = {
|
|
|
6304
6649
|
readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat];
|
|
6305
6650
|
/** Separator between chapter and page number (default: hyphen) */
|
|
6306
6651
|
readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator];
|
|
6652
|
+
/**
|
|
6653
|
+
* Puts the chapter number before each page number, such as "2-5" for page 5 of chapter 2. The chapter number is the
|
|
6654
|
+
* number of the last heading of this level (1 to 9, for `HeadingLevel.HEADING_1` to `HEADING_9`), so those headings
|
|
6655
|
+
* must be numbered through their style (`w:chapStyle`)
|
|
6656
|
+
*/
|
|
6657
|
+
readonly chapterHeadingLevel?: number;
|
|
6307
6658
|
};
|
|
6308
6659
|
|
|
6309
6660
|
/**
|
|
@@ -6444,7 +6795,11 @@ export declare type IParagraphPropertiesOptions = {
|
|
|
6444
6795
|
export declare type IParagraphPropertiesOptionsBase = {
|
|
6445
6796
|
/** Heading level (Heading1, Heading2, etc.) - applies predefined heading style */
|
|
6446
6797
|
readonly heading?: (typeof HeadingLevel)[keyof typeof HeadingLevel];
|
|
6447
|
-
/**
|
|
6798
|
+
/**
|
|
6799
|
+
* Whether to lay the paragraph out right-to-left, for languages such as Arabic and Hebrew.
|
|
6800
|
+
* A right-to-left paragraph starts on the right of the page, so it is right-aligned unless `alignment` says otherwise.
|
|
6801
|
+
* `alignment` `LEFT` and `RIGHT` still mean those sides of the page, while `START` and `END` follow the paragraph's direction.
|
|
6802
|
+
*/
|
|
6448
6803
|
readonly bidirectional?: boolean;
|
|
6449
6804
|
/** Whether to insert a page break before this paragraph */
|
|
6450
6805
|
readonly pageBreakBefore?: boolean;
|
|
@@ -6557,6 +6912,7 @@ export declare type IPatch = ParagraphPatch | FilePatch;
|
|
|
6557
6912
|
* @property fonts - Font configurations
|
|
6558
6913
|
* @property hyphenation - Hyphenation settings
|
|
6559
6914
|
* @property theme - The document's theme: its colors, and its fonts for headings and body text
|
|
6915
|
+
* @property pageNumbers - Works out the page each bookmark is on, so the page numbers of tables of contents and page references are written with the document
|
|
6560
6916
|
*/
|
|
6561
6917
|
export declare type IPropertiesOptions = {
|
|
6562
6918
|
readonly sections: readonly ISectionOptions[];
|
|
@@ -6594,6 +6950,12 @@ export declare type IPropertiesOptions = {
|
|
|
6594
6950
|
* from Office 2016 to 2021 unless the options change it
|
|
6595
6951
|
*/
|
|
6596
6952
|
readonly theme?: IThemeOptions;
|
|
6953
|
+
/**
|
|
6954
|
+
* Works out the page each bookmark is on, so the page numbers of the document's tables of contents and page
|
|
6955
|
+
* references are written with it, rather than left blank until Word updates them. Give it `estimatePageNumbers`
|
|
6956
|
+
* from `docx/layout`, which lays out the document's pages as Word would
|
|
6957
|
+
*/
|
|
6958
|
+
readonly pageNumbers?: PageNumberEstimator;
|
|
6597
6959
|
};
|
|
6598
6960
|
|
|
6599
6961
|
/**
|
|
@@ -6747,6 +7109,8 @@ export declare type ISectionPropertiesChangeOptions = IChangedAttributesProperti
|
|
|
6747
7109
|
* @property verticalAlign - Vertical alignment of text on page
|
|
6748
7110
|
* @property column - Column layout settings
|
|
6749
7111
|
* @property type - Section break type (next page, continuous, etc.)
|
|
7112
|
+
* @property footnoteProperties - Footnote placement and numbering
|
|
7113
|
+
* @property endnoteProperties - Endnote placement and numbering
|
|
6750
7114
|
*
|
|
6751
7115
|
* @see {@link SectionProperties}
|
|
6752
7116
|
*/
|
|
@@ -6784,6 +7148,10 @@ export declare type ISectionPropertiesOptionsBase = {
|
|
|
6784
7148
|
readonly column?: IColumnsAttributes;
|
|
6785
7149
|
/** Section break type (next page, continuous, even page, odd page) */
|
|
6786
7150
|
readonly type?: (typeof SectionType)[keyof typeof SectionType];
|
|
7151
|
+
/** Where the footnotes of the section are placed and how they are numbered */
|
|
7152
|
+
readonly footnoteProperties?: IFootnotePropertiesOptions;
|
|
7153
|
+
/** Where the endnotes of the section are placed and how they are numbered */
|
|
7154
|
+
readonly endnoteProperties?: IEndnotePropertiesOptions;
|
|
6787
7155
|
};
|
|
6788
7156
|
|
|
6789
7157
|
/**
|
|
@@ -6800,6 +7168,8 @@ declare type ISettingsOptions = {
|
|
|
6800
7168
|
readonly trackRevisions?: boolean;
|
|
6801
7169
|
/** Update fields when document is opened */
|
|
6802
7170
|
readonly updateFields?: boolean;
|
|
7171
|
+
/** Keep the document's embedded fonts when it is saved again, as Word's "Embed fonts in the file" option does */
|
|
7172
|
+
readonly embedFonts?: boolean;
|
|
6803
7173
|
/** Compatibility settings for older Word versions */
|
|
6804
7174
|
readonly compatibility?: ICompatibilityOptions;
|
|
6805
7175
|
/** Default distance between tab stops in twips */
|
|
@@ -6821,6 +7191,14 @@ export declare type IShadingAttributesProperties = {
|
|
|
6821
7191
|
readonly type?: (typeof ShadingType)[keyof typeof ShadingType];
|
|
6822
7192
|
};
|
|
6823
7193
|
|
|
7194
|
+
/**
|
|
7195
|
+
* Options for a simple field.
|
|
7196
|
+
*/
|
|
7197
|
+
export declare type ISimpleFieldOptions = {
|
|
7198
|
+
/** Locks the field so Word keeps the cached value when fields are updated. Not locked by default. */
|
|
7199
|
+
readonly locked?: boolean;
|
|
7200
|
+
};
|
|
7201
|
+
|
|
6824
7202
|
/**
|
|
6825
7203
|
* Properties for configuring paragraph spacing.
|
|
6826
7204
|
*
|
|
@@ -6923,9 +7301,9 @@ export declare type IStylesOptions = {
|
|
|
6923
7301
|
readonly default?: IDefaultStylesOptions;
|
|
6924
7302
|
/** Initial base XML component for styles root element */
|
|
6925
7303
|
readonly initialStyles?: BaseXmlComponent;
|
|
6926
|
-
/** Array of custom paragraph style definitions */
|
|
7304
|
+
/** Array of custom paragraph style definitions. Each takes the place of a default or external style with its id */
|
|
6927
7305
|
readonly paragraphStyles?: readonly IParagraphStyleOptions[];
|
|
6928
|
-
/** Array of custom character style definitions */
|
|
7306
|
+
/** Array of custom character style definitions. Each takes the place of a default or external style with its id */
|
|
6929
7307
|
readonly characterStyles?: readonly ICharacterStyleOptions[];
|
|
6930
7308
|
/** Array of styles imported from external sources */
|
|
6931
7309
|
readonly importedStyles?: readonly (XmlComponent | StyleForParagraph | StyleForCharacter | ImportedXmlComponent)[];
|
|
@@ -7353,8 +7731,10 @@ export declare type ITableOptions = {
|
|
|
7353
7731
|
* Widths of the grid columns (`w:tblGrid`) in twips (twentieths of a point).
|
|
7354
7732
|
*
|
|
7355
7733
|
* Word treats the grid as a hint and lays the table out from `width` and the cells'
|
|
7356
|
-
* widths,
|
|
7357
|
-
*
|
|
7734
|
+
* widths, sizing columns whose cells have no width to their content, so each cell
|
|
7735
|
+
* without a `width` of its own is given the width of the columns it spans, scaled up
|
|
7736
|
+
* to the table's `width` when that is wider. Google Docs, Apple Pages and QuickLook
|
|
7737
|
+
* lay the table out from the grid alone and ignore percentage widths. When omitted, the grid is derived from `width`
|
|
7358
7738
|
* and the cells' widths, resolved against the page (or, for nested tables, the
|
|
7359
7739
|
* parent cell) when the document is packed, so the table renders the same in every
|
|
7360
7740
|
* consumer. Supply explicit values to take full control of the grid.
|
|
@@ -7428,7 +7808,12 @@ export declare type ITableRowPropertiesOptions = ITableRowPropertiesOptionsBase
|
|
|
7428
7808
|
export declare type ITableRowPropertiesOptionsBase = {
|
|
7429
7809
|
/** Whether the row can be split across pages (cantSplit) */
|
|
7430
7810
|
readonly cantSplit?: boolean;
|
|
7431
|
-
/**
|
|
7811
|
+
/**
|
|
7812
|
+
* Whether the row should be repeated as a header row on each page (tblHeader).
|
|
7813
|
+
*
|
|
7814
|
+
* Only the table's first row and the rows straight after it that also set this repeat. Word ignores it on
|
|
7815
|
+
* any row further down, so to repeat a different header for each part of a table, make each part a table of its own.
|
|
7816
|
+
*/
|
|
7432
7817
|
readonly tableHeader?: boolean;
|
|
7433
7818
|
/** Row height configuration (trHeight) */
|
|
7434
7819
|
readonly height?: {
|
|
@@ -9118,6 +9503,31 @@ export declare type NonVisualDrawingPropertiesOptions = DrawingLinkOptions & {
|
|
|
9118
9503
|
readonly title?: string;
|
|
9119
9504
|
};
|
|
9120
9505
|
|
|
9506
|
+
/**
|
|
9507
|
+
* When the footnote or endnote numbering restarts.
|
|
9508
|
+
*
|
|
9509
|
+
* ## XSD Schema
|
|
9510
|
+
* ```xml
|
|
9511
|
+
* <xsd:simpleType name="ST_RestartNumber">
|
|
9512
|
+
* <xsd:restriction base="xsd:string">
|
|
9513
|
+
* <xsd:enumeration value="continuous"/>
|
|
9514
|
+
* <xsd:enumeration value="eachSect"/>
|
|
9515
|
+
* <xsd:enumeration value="eachPage"/>
|
|
9516
|
+
* </xsd:restriction>
|
|
9517
|
+
* </xsd:simpleType>
|
|
9518
|
+
* ```
|
|
9519
|
+
*
|
|
9520
|
+
* @publicApi
|
|
9521
|
+
*/
|
|
9522
|
+
export declare const NoteNumberRestart: {
|
|
9523
|
+
/** Numbering never restarts */
|
|
9524
|
+
readonly CONTINUOUS: "continuous";
|
|
9525
|
+
/** Numbering restarts in each section */
|
|
9526
|
+
readonly EACH_SECTION: "eachSect";
|
|
9527
|
+
/** Numbering restarts on each page */
|
|
9528
|
+
readonly EACH_PAGE: "eachPage";
|
|
9529
|
+
};
|
|
9530
|
+
|
|
9121
9531
|
/**
|
|
9122
9532
|
* Creates a field/cross reference to a numbered item in the document.
|
|
9123
9533
|
*
|
|
@@ -9259,6 +9669,7 @@ export declare const NumberFormat: {
|
|
|
9259
9669
|
readonly THAI_COUNTING: "thaiCounting";
|
|
9260
9670
|
readonly BAHT_TEXT: "bahtText";
|
|
9261
9671
|
readonly DOLLAR_TEXT: "dollarText";
|
|
9672
|
+
readonly CUSTOM: "custom";
|
|
9262
9673
|
};
|
|
9263
9674
|
|
|
9264
9675
|
/**
|
|
@@ -9652,6 +10063,7 @@ export declare class PackagePart {
|
|
|
9652
10063
|
private readonly addedTo;
|
|
9653
10064
|
/**
|
|
9654
10065
|
* @throws If the folder isn't a single folder name, or is one of the folders docx writes parts of its own in
|
|
10066
|
+
* @throws If the name or the extension isn't a single part of a file name, which could lead out of the folder
|
|
9655
10067
|
*/
|
|
9656
10068
|
constructor(options: PackagePartOptions);
|
|
9657
10069
|
/**
|
|
@@ -9696,7 +10108,7 @@ declare class PackageParts {
|
|
|
9696
10108
|
/**
|
|
9697
10109
|
* @param contentTypes - Where each part's content type is added
|
|
9698
10110
|
* @param existingPaths - The paths under word/ of the parts the package already has, such as a template's charts,
|
|
9699
|
-
* which new parts
|
|
10111
|
+
* which new parts don't take
|
|
9700
10112
|
*/
|
|
9701
10113
|
constructor(contentTypes: Pick<ContentTypes, "addOverride">, existingPaths?: ReadonlySet<string>);
|
|
9702
10114
|
/**
|
|
@@ -10010,6 +10422,32 @@ export declare class PageNumberElement extends EmptyElement {
|
|
|
10010
10422
|
constructor();
|
|
10011
10423
|
}
|
|
10012
10424
|
|
|
10425
|
+
/**
|
|
10426
|
+
* Works out which page each bookmark of a document starts on, and how many pages the document and its sections have,
|
|
10427
|
+
* from the body of the document as it is written, so the page numbers of its tables of contents, page references and
|
|
10428
|
+
* page counts can be written with it.
|
|
10429
|
+
*
|
|
10430
|
+
* `estimatePageNumbers`, from `docx/layout`, is one. Give it to a document as its `pageNumbers`.
|
|
10431
|
+
*
|
|
10432
|
+
* @param body - The document's body, formatted to be written as XML
|
|
10433
|
+
* @param context - The context the body was formatted in, with the document it is in
|
|
10434
|
+
*
|
|
10435
|
+
* @publicApi
|
|
10436
|
+
*/
|
|
10437
|
+
export declare type PageNumberEstimator = (body: IXmlableObject, context: IContext) => EstimatedPageNumbers;
|
|
10438
|
+
|
|
10439
|
+
/**
|
|
10440
|
+
* Where a {@link PageNumberEstimator} guessed at something it can't lay out as Word does.
|
|
10441
|
+
*
|
|
10442
|
+
* @publicApi
|
|
10443
|
+
*/
|
|
10444
|
+
export declare type PageNumberGuess = {
|
|
10445
|
+
/** What it guessed at, as why it would have stopped there, such as `"a font not in the width tables"` */
|
|
10446
|
+
readonly reason: string;
|
|
10447
|
+
/** The page it guessed on, counted from 1 for the first page of the document, whatever number the page shows */
|
|
10448
|
+
readonly page: number;
|
|
10449
|
+
};
|
|
10450
|
+
|
|
10013
10451
|
/**
|
|
10014
10452
|
* Specifies the separator character between chapter number and page number.
|
|
10015
10453
|
*
|
|
@@ -10037,7 +10475,7 @@ export declare const PageNumberSeparator: {
|
|
|
10037
10475
|
readonly COLON: "colon";
|
|
10038
10476
|
/** Em dash separator (—) */
|
|
10039
10477
|
readonly EM_DASH: "emDash";
|
|
10040
|
-
/** En dash separator (–) */
|
|
10478
|
+
/** En dash separator (–), written as `enDash` */
|
|
10041
10479
|
readonly EN_DASH: "endash";
|
|
10042
10480
|
};
|
|
10043
10481
|
|
|
@@ -10080,6 +10518,10 @@ export declare const PageOrientation: {
|
|
|
10080
10518
|
* The PAGEREF field displays the page number of the page containing
|
|
10081
10519
|
* the specified bookmark, useful for cross-references like "see page 5".
|
|
10082
10520
|
*
|
|
10521
|
+
* It is written dirty, so Word fills in the page number when it opens the document, after asking to. When the
|
|
10522
|
+
* document is given `pageNumbers`, it is written clean, with the number they work out, or blank when they couldn't,
|
|
10523
|
+
* and Word doesn't ask.
|
|
10524
|
+
*
|
|
10083
10525
|
* @publicApi
|
|
10084
10526
|
*
|
|
10085
10527
|
* @example
|
|
@@ -10176,6 +10618,24 @@ export declare class Paragraph extends FileChild {
|
|
|
10176
10618
|
private readonly properties;
|
|
10177
10619
|
constructor(options: string | IParagraphOptions);
|
|
10178
10620
|
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
10621
|
+
/**
|
|
10622
|
+
* Ends a section at this paragraph by adding the section's properties to the paragraph's properties,
|
|
10623
|
+
* as Word does with the last paragraph of each section but the last.
|
|
10624
|
+
*
|
|
10625
|
+
* The body adds them only while it is written and removes them afterwards with
|
|
10626
|
+
* {@link removeSectionProperties}, so the same paragraph can be used in other documents.
|
|
10627
|
+
*
|
|
10628
|
+
* @internal
|
|
10629
|
+
* @param sectionProperties - The properties of the section the paragraph ends
|
|
10630
|
+
*/
|
|
10631
|
+
addSectionProperties(sectionProperties: SectionProperties): void;
|
|
10632
|
+
/**
|
|
10633
|
+
* Removes the section properties added with {@link addSectionProperties}.
|
|
10634
|
+
*
|
|
10635
|
+
* @internal
|
|
10636
|
+
* @param sectionProperties - The properties of the section to remove
|
|
10637
|
+
*/
|
|
10638
|
+
removeSectionProperties(sectionProperties: SectionProperties): void;
|
|
10179
10639
|
addRunToFront(run: Run): Paragraph;
|
|
10180
10640
|
}
|
|
10181
10641
|
|
|
@@ -10318,6 +10778,21 @@ export declare class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
|
|
|
10318
10778
|
* @param item - The XML component to add to the paragraph properties
|
|
10319
10779
|
*/
|
|
10320
10780
|
push(item: XmlComponent): void;
|
|
10781
|
+
/**
|
|
10782
|
+
* Adds the section properties (`w:sectPr`) of the section this paragraph ends.
|
|
10783
|
+
*
|
|
10784
|
+
* They go after the paragraph's run properties and before its revision (`w:pPrChange`),
|
|
10785
|
+
* the order CT_PPr gives them.
|
|
10786
|
+
*
|
|
10787
|
+
* @param sectionProperties - The properties of the section the paragraph ends
|
|
10788
|
+
*/
|
|
10789
|
+
addSectionProperties(sectionProperties: SectionProperties): void;
|
|
10790
|
+
/**
|
|
10791
|
+
* Removes the section properties added with {@link addSectionProperties}.
|
|
10792
|
+
*
|
|
10793
|
+
* @param sectionProperties - The properties of the section to remove
|
|
10794
|
+
*/
|
|
10795
|
+
removeSectionProperties(sectionProperties: SectionProperties): void;
|
|
10321
10796
|
/**
|
|
10322
10797
|
* Prepares the paragraph properties for XML serialization.
|
|
10323
10798
|
*
|
|
@@ -10440,7 +10915,7 @@ declare type PatchDetectorOptions = {
|
|
|
10440
10915
|
*
|
|
10441
10916
|
* @publicApi
|
|
10442
10917
|
*/
|
|
10443
|
-
export declare const patchDocument: <T extends PatchDocumentOutputType = PatchDocumentOutputType>({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters, recursive, }: PatchDocumentOptions<T>) => Promise<OutputByType[T]>;
|
|
10918
|
+
export declare const patchDocument: <T extends PatchDocumentOutputType = PatchDocumentOutputType>({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters, recursive, footnotes, endnotes, pageNumbers, }: PatchDocumentOptions<T>) => Promise<OutputByType[T]>;
|
|
10444
10919
|
|
|
10445
10920
|
/**
|
|
10446
10921
|
* Options for patching a document.
|
|
@@ -10451,6 +10926,9 @@ export declare const patchDocument: <T extends PatchDocumentOutputType = PatchDo
|
|
|
10451
10926
|
* @property keepOriginalStyles - Whether to preserve original text formatting
|
|
10452
10927
|
* @property placeholderDelimiters - Custom delimiter characters for placeholders
|
|
10453
10928
|
* @property recursive - Whether to replace every occurrence of a placeholder in a paragraph, rather than only the first
|
|
10929
|
+
* @property footnotes - The footnotes that patches refer to with a `FootnoteReferenceRun`
|
|
10930
|
+
* @property endnotes - The endnotes that patches refer to with an `EndnoteReferenceRun`
|
|
10931
|
+
* @property pageNumbers - Works out the page each bookmark is on, to write the page numbers of page references
|
|
10454
10932
|
*/
|
|
10455
10933
|
export declare type PatchDocumentOptions<T extends PatchDocumentOutputType = PatchDocumentOutputType> = {
|
|
10456
10934
|
/** Output format type */
|
|
@@ -10458,10 +10936,10 @@ export declare type PatchDocumentOptions<T extends PatchDocumentOutputType = Pat
|
|
|
10458
10936
|
/** Input document data */
|
|
10459
10937
|
readonly data: InputDataType;
|
|
10460
10938
|
/**
|
|
10461
|
-
* Mapping of placeholder keys to patch content,
|
|
10462
|
-
* for a drawing whose alt text holds the placeholder
|
|
10939
|
+
* Mapping of placeholder keys to patch content, to a {@link TableRowsPatch} that repeats the rows of a table, or to a
|
|
10940
|
+
* {@link DrawingPatch}, such as `docx/charts`' `ChartDataPatch`, for a drawing whose alt text holds the placeholder
|
|
10463
10941
|
*/
|
|
10464
|
-
readonly patches: Readonly<Record<string, IPatch | DrawingPatch>>;
|
|
10942
|
+
readonly patches: Readonly<Record<string, IPatch | TableRowsPatch | DrawingPatch>>;
|
|
10465
10943
|
/** Preserve original formatting of replaced text (default: true) */
|
|
10466
10944
|
readonly keepOriginalStyles?: boolean;
|
|
10467
10945
|
/** Custom placeholder delimiters (default: {{ and }}) */
|
|
@@ -10471,6 +10949,23 @@ export declare type PatchDocumentOptions<T extends PatchDocumentOutputType = Pat
|
|
|
10471
10949
|
}>;
|
|
10472
10950
|
/** Replace every occurrence of a placeholder in a paragraph, rather than only the first (default: true) */
|
|
10473
10951
|
readonly recursive?: boolean;
|
|
10952
|
+
/**
|
|
10953
|
+
* The footnotes that patches refer to, by the id given to their `FootnoteReferenceRun`s, as in a `Document`. Each
|
|
10954
|
+
* reference a patch inserts gets a footnote of its own, with an id that none of the document's footnotes have
|
|
10955
|
+
*/
|
|
10956
|
+
readonly footnotes?: Readonly<Record<string, {
|
|
10957
|
+
readonly children: readonly Paragraph[];
|
|
10958
|
+
}>>;
|
|
10959
|
+
/** The endnotes that patches refer to, by the id given to their `EndnoteReferenceRun`s, as with footnotes */
|
|
10960
|
+
readonly endnotes?: Readonly<Record<string, {
|
|
10961
|
+
readonly children: readonly Paragraph[];
|
|
10962
|
+
}>>;
|
|
10963
|
+
/**
|
|
10964
|
+
* Works out the page each bookmark of the patched document is on, and how many pages it has, so the page numbers of
|
|
10965
|
+
* its tables of contents and page references, and its numbers of pages, are written with it, rather than left as they
|
|
10966
|
+
* were in the template. Give it `estimatePageNumbers` from `docx/layout`. See {@link TemplatePageNumberEstimator}
|
|
10967
|
+
*/
|
|
10968
|
+
readonly pageNumbers?: TemplatePageNumberEstimator;
|
|
10474
10969
|
};
|
|
10475
10970
|
|
|
10476
10971
|
/**
|
|
@@ -10478,6 +10973,27 @@ export declare type PatchDocumentOptions<T extends PatchDocumentOutputType = Pat
|
|
|
10478
10973
|
*/
|
|
10479
10974
|
export declare type PatchDocumentOutputType = OutputType;
|
|
10480
10975
|
|
|
10976
|
+
/**
|
|
10977
|
+
* A template once `patchDocument` has patched it, as a {@link TemplatePageNumberEstimator} reads it.
|
|
10978
|
+
*
|
|
10979
|
+
* @publicApi
|
|
10980
|
+
*/
|
|
10981
|
+
export declare type PatchedTemplate = {
|
|
10982
|
+
/**
|
|
10983
|
+
* Each XML part of the template's package, by its path in the package, such as "word/document.xml". Each is parsed as
|
|
10984
|
+
* `patchDocument` parses it, with xml-js's `xml2js`, not compact, and keeping the spaces between elements
|
|
10985
|
+
* (`captureSpacesBetweenElements`), as the spaces in a text element are its text
|
|
10986
|
+
*/
|
|
10987
|
+
readonly parts: ReadonlyMap<string, Element_2>;
|
|
10988
|
+
/** Each of its other parts, such as its pictures and the fonts it embeds, by its path in the package, as bytes */
|
|
10989
|
+
readonly binaryParts?: ReadonlyMap<string, Uint8Array>;
|
|
10990
|
+
/**
|
|
10991
|
+
* Each .docx the template imports (`w:altChunk`), which Word turns into paragraphs and tables of the template's own
|
|
10992
|
+
* when it opens it, unzipped and read as the template is, by its path in the template's package
|
|
10993
|
+
*/
|
|
10994
|
+
readonly importedDocuments?: ReadonlyMap<string, PatchedTemplate>;
|
|
10995
|
+
};
|
|
10996
|
+
|
|
10481
10997
|
/**
|
|
10482
10998
|
* Patch type enumeration.
|
|
10483
10999
|
*
|
|
@@ -10490,6 +11006,11 @@ export declare const PatchType: {
|
|
|
10490
11006
|
readonly DOCUMENT: "file";
|
|
10491
11007
|
/** Replace content within paragraphs (inline replacement) */
|
|
10492
11008
|
readonly PARAGRAPH: "paragraph";
|
|
11009
|
+
/**
|
|
11010
|
+
* Repeat the rows of a table that hold the placeholder's fields, such as `{{items.name}}`, once for each row of
|
|
11011
|
+
* data. See {@link TableRowsPatch}
|
|
11012
|
+
*/
|
|
11013
|
+
readonly TABLE_ROWS: "tableRows";
|
|
10493
11014
|
/**
|
|
10494
11015
|
* Change a drawing whose alt text holds the placeholder, and the parts it refers to, such as the data of a chart made
|
|
10495
11016
|
* in Word. See {@link DrawingPatch}
|
|
@@ -10796,6 +11317,16 @@ declare class Relationships extends XmlComponent {
|
|
|
10796
11317
|
* @param targetMode - Optional mode indicating if target is external
|
|
10797
11318
|
*/
|
|
10798
11319
|
addRelationship(id: number | string, type: RelationshipType, target: string, targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType]): void;
|
|
11320
|
+
/**
|
|
11321
|
+
* Creates a copy of the relationships given. Relationships added to the copy aren't added to them, so the compiler
|
|
11322
|
+
* adds the ones it writes for a part, such as to its images, to a copy, and packing a document again doesn't add
|
|
11323
|
+
* them a second time.
|
|
11324
|
+
*
|
|
11325
|
+
* Static, as `IContext` is public and has `Relationships`, so a new instance member would change the public API.
|
|
11326
|
+
*
|
|
11327
|
+
* @param relationships - The relationships to copy
|
|
11328
|
+
*/
|
|
11329
|
+
static copy(relationships: Relationships): Relationships;
|
|
10799
11330
|
/**
|
|
10800
11331
|
* Gets the count of relationships in this collection.
|
|
10801
11332
|
* Excludes the attributes element from the count.
|
|
@@ -11123,7 +11654,7 @@ export declare class SectionProperties extends XmlComponent {
|
|
|
11123
11654
|
* the width of a single column. Percentage table widths are resolved against it.
|
|
11124
11655
|
*/
|
|
11125
11656
|
private readonly availableTextWidth;
|
|
11126
|
-
constructor({ page: { size: { width, height, orientation, code, }, margin: { top, right, bottom, left, header, footer, gutter, }, pageNumbers, borders, textDirection, }, grid: { linePitch, charSpace, type: gridType }, headerWrapperGroup, footerWrapperGroup, lineNumbers, titlePage, verticalAlign, column, type, revision, }?: ISectionPropertiesOptions);
|
|
11657
|
+
constructor({ page: { size: { width, height, orientation, code, }, margin: { top, right, bottom, left, header, footer, gutter, }, pageNumbers, borders, textDirection, }, grid: { linePitch, charSpace, type: gridType }, headerWrapperGroup, footerWrapperGroup, lineNumbers, titlePage, verticalAlign, column, type, footnoteProperties, endnoteProperties, revision, }?: ISectionPropertiesOptions);
|
|
11127
11658
|
/**
|
|
11128
11659
|
* Width, in twips, available to block-level content (paragraphs and tables) in this section.
|
|
11129
11660
|
*
|
|
@@ -11198,6 +11729,10 @@ export declare class Separator extends EmptyElement {
|
|
|
11198
11729
|
* Each identifier maintains its own sequence, allowing you to have separate numbering
|
|
11199
11730
|
* for figures, tables, equations, etc.
|
|
11200
11731
|
*
|
|
11732
|
+
* It is written dirty, so Word numbers it when it opens the document, after asking to update the fields. When the
|
|
11733
|
+
* document is given `pageNumbers`, it is written clean, with its number counted as Word counts it, or blank where
|
|
11734
|
+
* Word's count isn't known, and Word doesn't ask.
|
|
11735
|
+
*
|
|
11201
11736
|
* Reference: http://officeopenxml.com/WPrun.php
|
|
11202
11737
|
*
|
|
11203
11738
|
* @publicApi
|
|
@@ -11239,6 +11774,7 @@ export declare class SequentialIdentifier extends Run {
|
|
|
11239
11774
|
* ```xml
|
|
11240
11775
|
* <xsd:complexType name="CT_Settings">
|
|
11241
11776
|
* <xsd:sequence>
|
|
11777
|
+
* <xsd:element name="embedTrueTypeFonts" type="CT_OnOff" minOccurs="0"/>
|
|
11242
11778
|
* <xsd:element name="trackRevisions" type="CT_OnOff" minOccurs="0"/>
|
|
11243
11779
|
* <xsd:element name="defaultTabStop" type="CT_TwipsMeasure" minOccurs="0"/>
|
|
11244
11780
|
* <xsd:element name="autoHyphenation" type="CT_OnOff" minOccurs="0"/>
|
|
@@ -11426,10 +11962,13 @@ export declare const signedTwipsMeasureValue: (val: UniversalMeasure | number) =
|
|
|
11426
11962
|
*
|
|
11427
11963
|
* // Simple field with cached value
|
|
11428
11964
|
* new SimpleField("DATE", "2024-01-01");
|
|
11965
|
+
*
|
|
11966
|
+
* // Locked field, Word keeps the cached value when fields are updated
|
|
11967
|
+
* new SimpleField("DATE", "2024-01-01", { locked: true });
|
|
11429
11968
|
* ```
|
|
11430
11969
|
*/
|
|
11431
11970
|
export declare class SimpleField extends XmlComponent {
|
|
11432
|
-
constructor(instruction: string, cachedValue?: string);
|
|
11971
|
+
constructor(instruction: string, cachedValue?: string, options?: ISimpleFieldOptions);
|
|
11433
11972
|
}
|
|
11434
11973
|
|
|
11435
11974
|
/**
|
|
@@ -11902,6 +12441,13 @@ export declare class Table extends FileChild {
|
|
|
11902
12441
|
* serializing.
|
|
11903
12442
|
*/
|
|
11904
12443
|
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
12444
|
+
/**
|
|
12445
|
+
* Gives each cell without a width of its own the width of the `columnWidths` it spans, as Word sizes the columns of
|
|
12446
|
+
* cells without a width to their content, whatever the grid says. When the table's width is wider than the columns
|
|
12447
|
+
* add up to, they are scaled up to fill it, as Word and LibreOffice lay them out, so columns given as proportions
|
|
12448
|
+
* keep them.
|
|
12449
|
+
*/
|
|
12450
|
+
private setCellWidths;
|
|
11905
12451
|
/**
|
|
11906
12452
|
* Finds the width in twips available to this table from the serialization context:
|
|
11907
12453
|
* the parent cell for a nested table, otherwise the text width of the section the
|
|
@@ -11993,7 +12539,14 @@ export declare class TableCell extends XmlComponent {
|
|
|
11993
12539
|
readonly options: WithHexColors<Omit<ITableCellOptions, "revision">> & {
|
|
11994
12540
|
readonly revision?: WithHexColors<NonNullable<ITableCellOptions["revision"]>>;
|
|
11995
12541
|
};
|
|
12542
|
+
private readonly properties;
|
|
11996
12543
|
constructor(options: ITableCellOptions);
|
|
12544
|
+
/**
|
|
12545
|
+
* Gives the cell, unless it has a width of its own, the width of the table's columns it spans, in twips.
|
|
12546
|
+
*
|
|
12547
|
+
* @internal
|
|
12548
|
+
*/
|
|
12549
|
+
setColumnWidth(twips: number): void;
|
|
11997
12550
|
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
11998
12551
|
}
|
|
11999
12552
|
|
|
@@ -12065,6 +12618,12 @@ export declare const TableLayoutType: {
|
|
|
12065
12618
|
* TableOfContents creates an auto-generated list of document headings
|
|
12066
12619
|
* with page numbers. It uses a TOC field code to generate entries.
|
|
12067
12620
|
*
|
|
12621
|
+
* Unless it is given `cachedEntries` or `contentChildren`, it is written with an
|
|
12622
|
+
* entry for each heading its options include, linked to a bookmark on the heading,
|
|
12623
|
+
* so it isn't empty before Word updates it or in applications that don't update it.
|
|
12624
|
+
* The page numbers are left for Word to fill in when it updates the field, unless the document's `pageNumbers`
|
|
12625
|
+
* writes them.
|
|
12626
|
+
*
|
|
12068
12627
|
* Reference: http://officeopenxml.com/WPtableOfContents.php
|
|
12069
12628
|
*
|
|
12070
12629
|
* @publicApi
|
|
@@ -12089,6 +12648,8 @@ export declare const TableLayoutType: {
|
|
|
12089
12648
|
* ```
|
|
12090
12649
|
*/
|
|
12091
12650
|
export declare class TableOfContents extends FileChild {
|
|
12651
|
+
/** What it is filled in with from the headings, when it isn't given its content */
|
|
12652
|
+
private readonly fromHeadings?;
|
|
12092
12653
|
constructor(alias?: string, { contentChildren, cachedEntries, beginDirty, ...properties }?: ITableOfContentsOptions & {
|
|
12093
12654
|
readonly contentChildren?: readonly (XmlComponent | string)[];
|
|
12094
12655
|
/**
|
|
@@ -12097,8 +12658,20 @@ export declare class TableOfContents extends FileChild {
|
|
|
12097
12658
|
* Note that indentation should come from the paragraph styles defined on the document. By default the styles are TOC1, TOC2, etc. These can be overridden with stylesWithLevels (\t)
|
|
12098
12659
|
*/
|
|
12099
12660
|
readonly cachedEntries?: readonly ToCEntry[];
|
|
12661
|
+
/**
|
|
12662
|
+
* Whether the field is written dirty, so Word updates the table when it opens the document, after asking to.
|
|
12663
|
+
* Default is dirty, unless the document is given `pageNumbers`: then it is written clean, so Word shows it as
|
|
12664
|
+
* it is written, and doesn't ask.
|
|
12665
|
+
*/
|
|
12100
12666
|
readonly beginDirty?: boolean;
|
|
12101
12667
|
});
|
|
12668
|
+
/**
|
|
12669
|
+
* Written empty, and filled in from the headings once the body it is in is written, unless it was given its content.
|
|
12670
|
+
* The page numbers are aligned to the right of the text in its section.
|
|
12671
|
+
*/
|
|
12672
|
+
prepForXml(context: IContext): IXmlableObject | undefined;
|
|
12673
|
+
/** The width of the text in the section it is in */
|
|
12674
|
+
private textWidthIn;
|
|
12102
12675
|
private getTabStopsForLevel;
|
|
12103
12676
|
private buildCachedContentRun;
|
|
12104
12677
|
private buildCachedContentParagraphChild;
|
|
@@ -12190,6 +12763,52 @@ export declare class TableRowPropertiesChange extends XmlComponent {
|
|
|
12190
12763
|
constructor(options: ITableRowPropertiesChangeOptions);
|
|
12191
12764
|
}
|
|
12192
12765
|
|
|
12766
|
+
/**
|
|
12767
|
+
* Patch definition that repeats the rows of a table in the template, once for each row of data, so a table can be
|
|
12768
|
+
* designed in Word and filled in with any number of rows.
|
|
12769
|
+
*
|
|
12770
|
+
* The rows it repeats are those that hold its fields: placeholders made of the patch's key, a dot and the field's name,
|
|
12771
|
+
* such as `{{items.name}}` and `{{items.price}}` for the patch `items`. Each copy's fields are patched with a row's
|
|
12772
|
+
* patches, by their field's name, and the other rows of the table, such as its header, are kept as they are. Rows next
|
|
12773
|
+
* to each other are repeated together, such as a row for an item and a row for its notes.
|
|
12774
|
+
*
|
|
12775
|
+
* A field that a row has no patch for is left empty. With no rows, the rows are removed, and so is a table left with
|
|
12776
|
+
* none. The other patches are applied after the rows are repeated, so a placeholder of theirs in a repeated row, such as
|
|
12777
|
+
* `{{currency}}`, is patched in every copy.
|
|
12778
|
+
*
|
|
12779
|
+
* @example
|
|
12780
|
+
* ```typescript
|
|
12781
|
+
* const text = (value: string): IPatch => ({ type: PatchType.PARAGRAPH, children: [new TextRun(value)] });
|
|
12782
|
+
*
|
|
12783
|
+
* await patchDocument({
|
|
12784
|
+
* outputType: "nodebuffer",
|
|
12785
|
+
* data: template,
|
|
12786
|
+
* patches: {
|
|
12787
|
+
* items: {
|
|
12788
|
+
* type: PatchType.TABLE_ROWS,
|
|
12789
|
+
* rows: [
|
|
12790
|
+
* { name: text("Apples"), price: text("1.20") },
|
|
12791
|
+
* { name: text("Pears"), price: text("0.90") },
|
|
12792
|
+
* ],
|
|
12793
|
+
* },
|
|
12794
|
+
* },
|
|
12795
|
+
* });
|
|
12796
|
+
* ```
|
|
12797
|
+
*
|
|
12798
|
+
* @publicApi
|
|
12799
|
+
*/
|
|
12800
|
+
export declare type TableRowsPatch = {
|
|
12801
|
+
/** Indicates this patch repeats the rows of a table */
|
|
12802
|
+
readonly type: typeof PatchType.TABLE_ROWS;
|
|
12803
|
+
/**
|
|
12804
|
+
* The patches for each copy of the rows, by the name of the field they patch, such as `name` for `{{items.name}}`.
|
|
12805
|
+
* A field's patch can repeat rows of a table in the copy in turn, whose fields are then such as
|
|
12806
|
+
* `{{items.parts.name}}`. When those fields are in the copy's own row, rather than in a table in it, the row is
|
|
12807
|
+
* repeated for each part, with its item's fields, and an item without parts has no row
|
|
12808
|
+
*/
|
|
12809
|
+
readonly rows: readonly Readonly<Record<string, IPatch | TableRowsPatch | undefined>>[];
|
|
12810
|
+
};
|
|
12811
|
+
|
|
12193
12812
|
export declare type TableVerticalAlign = (typeof VerticalAlignTable)[keyof typeof VerticalAlignTable];
|
|
12194
12813
|
|
|
12195
12814
|
/**
|
|
@@ -12328,6 +12947,17 @@ export declare type TemplatePackage = {
|
|
|
12328
12947
|
readonly format: (content: XmlComponent) => Element_2;
|
|
12329
12948
|
};
|
|
12330
12949
|
|
|
12950
|
+
/**
|
|
12951
|
+
* Works out which page each bookmark of a template starts on, and how many pages it and each of its sections have, once
|
|
12952
|
+
* `patchDocument` has patched it, so the page numbers of its tables of contents and page references, and its numbers of
|
|
12953
|
+
* pages, are written with it.
|
|
12954
|
+
*
|
|
12955
|
+
* `estimatePageNumbers`, from `docx/layout`, is one. Give it to `patchDocument` as its `pageNumbers`.
|
|
12956
|
+
*
|
|
12957
|
+
* @publicApi
|
|
12958
|
+
*/
|
|
12959
|
+
export declare type TemplatePageNumberEstimator = (template: PatchedTemplate) => EstimatedPageNumbers;
|
|
12960
|
+
|
|
12331
12961
|
/**
|
|
12332
12962
|
* A part of a template's package, as a {@link DrawingPatch} sees it.
|
|
12333
12963
|
*
|