docx-plus 0.0.4 → 0.0.6
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/LICENSE +1 -1
- package/README.md +20 -22
- package/dist/index.cjs +439 -30
- package/dist/index.d.cts +247 -71
- package/dist/index.d.mts +247 -71
- package/dist/index.iife.js +439 -30
- package/dist/index.mjs +436 -30
- package/dist/index.umd.js +439 -30
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -394,6 +394,9 @@
|
|
|
394
394
|
rsidSect: "w:rsidSect",
|
|
395
395
|
space: "w:space",
|
|
396
396
|
sz: "w:sz",
|
|
397
|
+
themeColor: "w:themeColor",
|
|
398
|
+
themeShade: "w:themeShade",
|
|
399
|
+
themeTint: "w:themeTint",
|
|
397
400
|
top: "w:top",
|
|
398
401
|
type: "w:type",
|
|
399
402
|
val: "w:val",
|
|
@@ -920,6 +923,49 @@
|
|
|
920
923
|
* ```
|
|
921
924
|
*/
|
|
922
925
|
const dateTimeValue = (val) => val.toISOString();
|
|
926
|
+
/**
|
|
927
|
+
* Theme color values used throughout OOXML for referencing document theme colors.
|
|
928
|
+
*
|
|
929
|
+
* Reference: ST_ThemeColor in OOXML specification
|
|
930
|
+
*
|
|
931
|
+
* @publicApi
|
|
932
|
+
*/
|
|
933
|
+
const ThemeColor = {
|
|
934
|
+
DARK1: "dark1",
|
|
935
|
+
LIGHT1: "light1",
|
|
936
|
+
DARK2: "dark2",
|
|
937
|
+
LIGHT2: "light2",
|
|
938
|
+
ACCENT1: "accent1",
|
|
939
|
+
ACCENT2: "accent2",
|
|
940
|
+
ACCENT3: "accent3",
|
|
941
|
+
ACCENT4: "accent4",
|
|
942
|
+
ACCENT5: "accent5",
|
|
943
|
+
ACCENT6: "accent6",
|
|
944
|
+
HYPERLINK: "hyperlink",
|
|
945
|
+
FOLLOWED_HYPERLINK: "followedHyperlink",
|
|
946
|
+
NONE: "none",
|
|
947
|
+
BACKGROUND1: "background1",
|
|
948
|
+
TEXT1: "text1",
|
|
949
|
+
BACKGROUND2: "background2",
|
|
950
|
+
TEXT2: "text2"
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* Theme font values used for referencing document theme fonts.
|
|
954
|
+
*
|
|
955
|
+
* Reference: ST_Theme in OOXML specification
|
|
956
|
+
*
|
|
957
|
+
* @publicApi
|
|
958
|
+
*/
|
|
959
|
+
const ThemeFont = {
|
|
960
|
+
MAJOR_EAST_ASIA: "majorEastAsia",
|
|
961
|
+
MAJOR_BIDI: "majorBidi",
|
|
962
|
+
MAJOR_ASCII: "majorAscii",
|
|
963
|
+
MAJOR_H_ANSI: "majorHAnsi",
|
|
964
|
+
MINOR_EAST_ASIA: "minorEastAsia",
|
|
965
|
+
MINOR_BIDI: "minorBidi",
|
|
966
|
+
MINOR_ASCII: "minorAscii",
|
|
967
|
+
MINOR_H_ANSI: "minorHAnsi"
|
|
968
|
+
};
|
|
923
969
|
//#endregion
|
|
924
970
|
//#region src/file/xml-components/simple-elements.ts
|
|
925
971
|
/**
|
|
@@ -1332,12 +1378,20 @@
|
|
|
1332
1378
|
* });
|
|
1333
1379
|
* ```
|
|
1334
1380
|
*/
|
|
1335
|
-
const createBorderElement = (elementName, { color, size, space, style }) => new BuilderElement({
|
|
1381
|
+
const createBorderElement = (elementName, { color, size, space, style, themeColor, themeTint, themeShade, shadow, frame }) => new BuilderElement({
|
|
1336
1382
|
attributes: {
|
|
1337
1383
|
color: {
|
|
1338
1384
|
key: "w:color",
|
|
1339
1385
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
1340
1386
|
},
|
|
1387
|
+
frame: {
|
|
1388
|
+
key: "w:frame",
|
|
1389
|
+
value: frame
|
|
1390
|
+
},
|
|
1391
|
+
shadow: {
|
|
1392
|
+
key: "w:shadow",
|
|
1393
|
+
value: shadow
|
|
1394
|
+
},
|
|
1341
1395
|
size: {
|
|
1342
1396
|
key: "w:sz",
|
|
1343
1397
|
value: size === void 0 ? void 0 : eighthPointMeasureValue(size)
|
|
@@ -1349,6 +1403,18 @@
|
|
|
1349
1403
|
style: {
|
|
1350
1404
|
key: "w:val",
|
|
1351
1405
|
value: style
|
|
1406
|
+
},
|
|
1407
|
+
themeColor: {
|
|
1408
|
+
key: "w:themeColor",
|
|
1409
|
+
value: themeColor
|
|
1410
|
+
},
|
|
1411
|
+
themeShade: {
|
|
1412
|
+
key: "w:themeShade",
|
|
1413
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
1414
|
+
},
|
|
1415
|
+
themeTint: {
|
|
1416
|
+
key: "w:themeTint",
|
|
1417
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
1352
1418
|
}
|
|
1353
1419
|
},
|
|
1354
1420
|
name: elementName
|
|
@@ -1552,20 +1618,32 @@
|
|
|
1552
1618
|
* </xsd:complexType>
|
|
1553
1619
|
* ```
|
|
1554
1620
|
*/
|
|
1555
|
-
const createIndent = ({ start, end, left, right, hanging, firstLine }) => new BuilderElement({
|
|
1621
|
+
const createIndent = ({ start, startChars, end, endChars, left, right, hanging, hangingChars, firstLine, firstLineChars }) => new BuilderElement({
|
|
1556
1622
|
attributes: {
|
|
1557
1623
|
end: {
|
|
1558
1624
|
key: "w:end",
|
|
1559
1625
|
value: end === void 0 ? void 0 : signedTwipsMeasureValue(end)
|
|
1560
1626
|
},
|
|
1627
|
+
endChars: {
|
|
1628
|
+
key: "w:endChars",
|
|
1629
|
+
value: endChars === void 0 ? void 0 : decimalNumber(endChars)
|
|
1630
|
+
},
|
|
1561
1631
|
firstLine: {
|
|
1562
1632
|
key: "w:firstLine",
|
|
1563
1633
|
value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine)
|
|
1564
1634
|
},
|
|
1635
|
+
firstLineChars: {
|
|
1636
|
+
key: "w:firstLineChars",
|
|
1637
|
+
value: firstLineChars === void 0 ? void 0 : decimalNumber(firstLineChars)
|
|
1638
|
+
},
|
|
1565
1639
|
hanging: {
|
|
1566
1640
|
key: "w:hanging",
|
|
1567
1641
|
value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging)
|
|
1568
1642
|
},
|
|
1643
|
+
hangingChars: {
|
|
1644
|
+
key: "w:hangingChars",
|
|
1645
|
+
value: hangingChars === void 0 ? void 0 : decimalNumber(hangingChars)
|
|
1646
|
+
},
|
|
1569
1647
|
left: {
|
|
1570
1648
|
key: "w:left",
|
|
1571
1649
|
value: left === void 0 ? void 0 : signedTwipsMeasureValue(left)
|
|
@@ -1577,6 +1655,10 @@
|
|
|
1577
1655
|
start: {
|
|
1578
1656
|
key: "w:start",
|
|
1579
1657
|
value: start === void 0 ? void 0 : signedTwipsMeasureValue(start)
|
|
1658
|
+
},
|
|
1659
|
+
startChars: {
|
|
1660
|
+
key: "w:startChars",
|
|
1661
|
+
value: startChars === void 0 ? void 0 : decimalNumber(startChars)
|
|
1580
1662
|
}
|
|
1581
1663
|
},
|
|
1582
1664
|
name: "w:ind"
|
|
@@ -2027,7 +2109,7 @@
|
|
|
2027
2109
|
*
|
|
2028
2110
|
* Reference: http://officeopenxml.com/WPshading.php
|
|
2029
2111
|
*/
|
|
2030
|
-
const createShading = ({ fill, color, type }) => new BuilderElement({
|
|
2112
|
+
const createShading = ({ fill, color, type, themeColor, themeTint, themeShade, themeFill, themeFillTint, themeFillShade }) => new BuilderElement({
|
|
2031
2113
|
attributes: {
|
|
2032
2114
|
color: {
|
|
2033
2115
|
key: "w:color",
|
|
@@ -2037,6 +2119,30 @@
|
|
|
2037
2119
|
key: "w:fill",
|
|
2038
2120
|
value: fill === void 0 ? void 0 : hexColorValue(fill)
|
|
2039
2121
|
},
|
|
2122
|
+
themeColor: {
|
|
2123
|
+
key: "w:themeColor",
|
|
2124
|
+
value: themeColor
|
|
2125
|
+
},
|
|
2126
|
+
themeFill: {
|
|
2127
|
+
key: "w:themeFill",
|
|
2128
|
+
value: themeFill
|
|
2129
|
+
},
|
|
2130
|
+
themeFillShade: {
|
|
2131
|
+
key: "w:themeFillShade",
|
|
2132
|
+
value: themeFillShade === void 0 ? void 0 : uCharHexNumber(themeFillShade)
|
|
2133
|
+
},
|
|
2134
|
+
themeFillTint: {
|
|
2135
|
+
key: "w:themeFillTint",
|
|
2136
|
+
value: themeFillTint === void 0 ? void 0 : uCharHexNumber(themeFillTint)
|
|
2137
|
+
},
|
|
2138
|
+
themeShade: {
|
|
2139
|
+
key: "w:themeShade",
|
|
2140
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2141
|
+
},
|
|
2142
|
+
themeTint: {
|
|
2143
|
+
key: "w:themeTint",
|
|
2144
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2145
|
+
},
|
|
2040
2146
|
type: {
|
|
2041
2147
|
key: "w:val",
|
|
2042
2148
|
value: type
|
|
@@ -2183,6 +2289,57 @@
|
|
|
2183
2289
|
}
|
|
2184
2290
|
};
|
|
2185
2291
|
//#endregion
|
|
2292
|
+
//#region src/file/paragraph/run/east-asian-layout.ts
|
|
2293
|
+
/**
|
|
2294
|
+
* East Asian layout module for WordprocessingML run properties.
|
|
2295
|
+
*
|
|
2296
|
+
* Specifies East Asian typography settings for a run, including
|
|
2297
|
+
* character combination, vertical text, and compression.
|
|
2298
|
+
*
|
|
2299
|
+
* Reference: ISO/IEC 29500-4, CT_EastAsianLayout
|
|
2300
|
+
*
|
|
2301
|
+
* @module
|
|
2302
|
+
*/
|
|
2303
|
+
/**
|
|
2304
|
+
* Creates an East Asian layout element (w:eastAsianLayout) for a run.
|
|
2305
|
+
*
|
|
2306
|
+
* ## XSD Schema
|
|
2307
|
+
* ```xml
|
|
2308
|
+
* <xsd:complexType name="CT_EastAsianLayout">
|
|
2309
|
+
* <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
|
|
2310
|
+
* <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
|
|
2311
|
+
* <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
|
|
2312
|
+
* <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
|
|
2313
|
+
* <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
|
|
2314
|
+
* </xsd:complexType>
|
|
2315
|
+
* ```
|
|
2316
|
+
*/
|
|
2317
|
+
const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
|
|
2318
|
+
attributes: {
|
|
2319
|
+
combine: {
|
|
2320
|
+
key: "w:combine",
|
|
2321
|
+
value: combine
|
|
2322
|
+
},
|
|
2323
|
+
combineBrackets: {
|
|
2324
|
+
key: "w:combineBrackets",
|
|
2325
|
+
value: combineBrackets
|
|
2326
|
+
},
|
|
2327
|
+
id: {
|
|
2328
|
+
key: "w:id",
|
|
2329
|
+
value: id === void 0 ? void 0 : decimalNumber(id)
|
|
2330
|
+
},
|
|
2331
|
+
vert: {
|
|
2332
|
+
key: "w:vert",
|
|
2333
|
+
value: vert
|
|
2334
|
+
},
|
|
2335
|
+
vertCompress: {
|
|
2336
|
+
key: "w:vertCompress",
|
|
2337
|
+
value: vertCompress
|
|
2338
|
+
}
|
|
2339
|
+
},
|
|
2340
|
+
name: "w:eastAsianLayout"
|
|
2341
|
+
});
|
|
2342
|
+
//#endregion
|
|
2186
2343
|
//#region src/file/paragraph/run/emphasis-mark.ts
|
|
2187
2344
|
/**
|
|
2188
2345
|
* Emphasis mark module for WordprocessingML run properties.
|
|
@@ -2215,7 +2372,13 @@
|
|
|
2215
2372
|
*
|
|
2216
2373
|
* @publicApi
|
|
2217
2374
|
*/
|
|
2218
|
-
const EmphasisMarkType = {
|
|
2375
|
+
const EmphasisMarkType = {
|
|
2376
|
+
NONE: "none",
|
|
2377
|
+
COMMA: "comma",
|
|
2378
|
+
CIRCLE: "circle",
|
|
2379
|
+
DOT: "dot",
|
|
2380
|
+
UNDER_DOT: "underDot"
|
|
2381
|
+
};
|
|
2219
2382
|
/**
|
|
2220
2383
|
* Creates an emphasis mark element for a WordprocessingML document.
|
|
2221
2384
|
*
|
|
@@ -2306,16 +2469,27 @@
|
|
|
2306
2469
|
*
|
|
2307
2470
|
* @example
|
|
2308
2471
|
* ```typescript
|
|
2309
|
-
* new Color("FF0000"); // Red text
|
|
2472
|
+
* new Color("FF0000"); // Red text (backward compatible)
|
|
2310
2473
|
* new Color("auto"); // Automatic color
|
|
2474
|
+
* new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
|
|
2311
2475
|
* ```
|
|
2312
2476
|
*
|
|
2313
2477
|
* @internal
|
|
2314
2478
|
*/
|
|
2315
2479
|
var Color = class extends XmlComponent {
|
|
2316
|
-
constructor(
|
|
2480
|
+
constructor(colorOrOptions) {
|
|
2317
2481
|
super("w:color");
|
|
2318
|
-
|
|
2482
|
+
if (typeof colorOrOptions === "string") {
|
|
2483
|
+
this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
const opts = colorOrOptions;
|
|
2487
|
+
this.root.push(new Attributes({
|
|
2488
|
+
val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
|
|
2489
|
+
themeColor: opts.themeColor,
|
|
2490
|
+
themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
|
|
2491
|
+
themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
|
|
2492
|
+
}));
|
|
2319
2493
|
}
|
|
2320
2494
|
};
|
|
2321
2495
|
/**
|
|
@@ -2514,18 +2688,34 @@
|
|
|
2514
2688
|
key: "w:ascii",
|
|
2515
2689
|
value: attrs.ascii
|
|
2516
2690
|
},
|
|
2691
|
+
asciiTheme: {
|
|
2692
|
+
key: "w:asciiTheme",
|
|
2693
|
+
value: attrs.asciiTheme
|
|
2694
|
+
},
|
|
2517
2695
|
cs: {
|
|
2518
2696
|
key: "w:cs",
|
|
2519
2697
|
value: attrs.cs
|
|
2520
2698
|
},
|
|
2699
|
+
cstheme: {
|
|
2700
|
+
key: "w:cstheme",
|
|
2701
|
+
value: attrs.cstheme
|
|
2702
|
+
},
|
|
2521
2703
|
eastAsia: {
|
|
2522
2704
|
key: "w:eastAsia",
|
|
2523
2705
|
value: attrs.eastAsia
|
|
2524
2706
|
},
|
|
2707
|
+
eastAsiaTheme: {
|
|
2708
|
+
key: "w:eastAsiaTheme",
|
|
2709
|
+
value: attrs.eastAsiaTheme
|
|
2710
|
+
},
|
|
2525
2711
|
hAnsi: {
|
|
2526
2712
|
key: "w:hAnsi",
|
|
2527
2713
|
value: attrs.hAnsi
|
|
2528
2714
|
},
|
|
2715
|
+
hAnsiTheme: {
|
|
2716
|
+
key: "w:hAnsiTheme",
|
|
2717
|
+
value: attrs.hAnsiTheme
|
|
2718
|
+
},
|
|
2529
2719
|
hint: {
|
|
2530
2720
|
key: "w:hint",
|
|
2531
2721
|
value: attrs.hint
|
|
@@ -2682,12 +2872,24 @@
|
|
|
2682
2872
|
* createUnderline(UnderlineType.WAVE, "FF0000");
|
|
2683
2873
|
* ```
|
|
2684
2874
|
*/
|
|
2685
|
-
const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
|
|
2875
|
+
const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
|
|
2686
2876
|
attributes: {
|
|
2687
2877
|
color: {
|
|
2688
2878
|
key: "w:color",
|
|
2689
2879
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
2690
2880
|
},
|
|
2881
|
+
themeColor: {
|
|
2882
|
+
key: "w:themeColor",
|
|
2883
|
+
value: themeColor
|
|
2884
|
+
},
|
|
2885
|
+
themeShade: {
|
|
2886
|
+
key: "w:themeShade",
|
|
2887
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2888
|
+
},
|
|
2889
|
+
themeTint: {
|
|
2890
|
+
key: "w:themeTint",
|
|
2891
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2892
|
+
},
|
|
2691
2893
|
val: {
|
|
2692
2894
|
key: "w:val",
|
|
2693
2895
|
value: underlineType
|
|
@@ -2839,6 +3041,9 @@
|
|
|
2839
3041
|
if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
|
|
2840
3042
|
if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
|
|
2841
3043
|
if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
|
|
3044
|
+
if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
|
|
3045
|
+
if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
|
|
3046
|
+
if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
|
|
2842
3047
|
if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
|
|
2843
3048
|
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
2844
3049
|
if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
|
|
@@ -2864,6 +3069,9 @@
|
|
|
2864
3069
|
if (options.language) this.push(createLanguageComponent(options.language));
|
|
2865
3070
|
if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
|
|
2866
3071
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
3072
|
+
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
3073
|
+
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
3074
|
+
if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
|
|
2867
3075
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
2868
3076
|
}
|
|
2869
3077
|
push(item) {
|
|
@@ -3299,18 +3507,6 @@
|
|
|
3299
3507
|
* ```
|
|
3300
3508
|
*/
|
|
3301
3509
|
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
3302
|
-
/**
|
|
3303
|
-
* Encode a string to UTF-8 bytes.
|
|
3304
|
-
*
|
|
3305
|
-
* This is used to pre-encode XML content before passing to fflate's zipSync,
|
|
3306
|
-
* which expects Uint8Array input for text content.
|
|
3307
|
-
*
|
|
3308
|
-
* The copy via `new Uint8Array()` ensures the returned array uses the
|
|
3309
|
-
* current module's Uint8Array constructor, avoiding cross-realm issues
|
|
3310
|
-
* in test environments (happy-dom) where TextEncoder returns a different
|
|
3311
|
-
* realm's Uint8Array.
|
|
3312
|
-
*/
|
|
3313
|
-
const encodeUtf8 = (str) => new Uint8Array(new TextEncoder().encode(str));
|
|
3314
3510
|
//#endregion
|
|
3315
3511
|
//#region src/file/drawing/floating/floating-position.ts
|
|
3316
3512
|
/**
|
|
@@ -6973,7 +7169,7 @@
|
|
|
6973
7169
|
* });
|
|
6974
7170
|
* ```
|
|
6975
7171
|
*/
|
|
6976
|
-
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
|
|
7172
|
+
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
|
|
6977
7173
|
attributes: {
|
|
6978
7174
|
after: {
|
|
6979
7175
|
key: "w:after",
|
|
@@ -6983,6 +7179,10 @@
|
|
|
6983
7179
|
key: "w:afterAutospacing",
|
|
6984
7180
|
value: afterAutoSpacing
|
|
6985
7181
|
},
|
|
7182
|
+
afterLines: {
|
|
7183
|
+
key: "w:afterLines",
|
|
7184
|
+
value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
|
|
7185
|
+
},
|
|
6986
7186
|
before: {
|
|
6987
7187
|
key: "w:before",
|
|
6988
7188
|
value: before
|
|
@@ -6991,6 +7191,10 @@
|
|
|
6991
7191
|
key: "w:beforeAutospacing",
|
|
6992
7192
|
value: beforeAutoSpacing
|
|
6993
7193
|
},
|
|
7194
|
+
beforeLines: {
|
|
7195
|
+
key: "w:beforeLines",
|
|
7196
|
+
value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
|
|
7197
|
+
},
|
|
6994
7198
|
line: {
|
|
6995
7199
|
key: "w:line",
|
|
6996
7200
|
value: line
|
|
@@ -7101,6 +7305,7 @@
|
|
|
7101
7305
|
*/
|
|
7102
7306
|
const LeaderType = {
|
|
7103
7307
|
DOT: "dot",
|
|
7308
|
+
HEAVY: "heavy",
|
|
7104
7309
|
HYPHEN: "hyphen",
|
|
7105
7310
|
MIDDLE_DOT: "middleDot",
|
|
7106
7311
|
NONE: "none",
|
|
@@ -8373,6 +8578,34 @@
|
|
|
8373
8578
|
* @module
|
|
8374
8579
|
*/
|
|
8375
8580
|
/**
|
|
8581
|
+
* Vertical text alignment types for paragraphs.
|
|
8582
|
+
*
|
|
8583
|
+
* Specifies the vertical alignment of text within the paragraph.
|
|
8584
|
+
*
|
|
8585
|
+
* @publicApi
|
|
8586
|
+
*/
|
|
8587
|
+
const TextAlignmentType = {
|
|
8588
|
+
TOP: "top",
|
|
8589
|
+
CENTER: "center",
|
|
8590
|
+
BASELINE: "baseline",
|
|
8591
|
+
BOTTOM: "bottom",
|
|
8592
|
+
AUTO: "auto"
|
|
8593
|
+
};
|
|
8594
|
+
/**
|
|
8595
|
+
* Textbox tight wrap types for paragraphs.
|
|
8596
|
+
*
|
|
8597
|
+
* Specifies how tightly text wraps around a textbox.
|
|
8598
|
+
*
|
|
8599
|
+
* @publicApi
|
|
8600
|
+
*/
|
|
8601
|
+
const TextboxTightWrapType = {
|
|
8602
|
+
NONE: "none",
|
|
8603
|
+
ALL_LINES: "allLines",
|
|
8604
|
+
FIRST_AND_LAST_LINE: "firstAndLastLine",
|
|
8605
|
+
FIRST_LINE_ONLY: "firstLineOnly",
|
|
8606
|
+
LAST_LINE_ONLY: "lastLineOnly"
|
|
8607
|
+
};
|
|
8608
|
+
/**
|
|
8376
8609
|
* Represents paragraph properties (pPr) in a WordprocessingML document.
|
|
8377
8610
|
*
|
|
8378
8611
|
* The paragraph properties element specifies all formatting applied to a paragraph,
|
|
@@ -8535,6 +8768,27 @@
|
|
|
8535
8768
|
if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
|
|
8536
8769
|
if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
8537
8770
|
if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
8771
|
+
if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
8772
|
+
if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
|
|
8773
|
+
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
8774
|
+
if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
|
|
8775
|
+
if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
|
|
8776
|
+
if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
|
|
8777
|
+
if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
|
|
8778
|
+
if (options.textAlignment !== void 0) this.push(new BuilderElement({
|
|
8779
|
+
attributes: { val: {
|
|
8780
|
+
key: "w:val",
|
|
8781
|
+
value: options.textAlignment
|
|
8782
|
+
} },
|
|
8783
|
+
name: "w:textAlignment"
|
|
8784
|
+
}));
|
|
8785
|
+
if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
|
|
8786
|
+
attributes: { val: {
|
|
8787
|
+
key: "w:val",
|
|
8788
|
+
value: options.textboxTightWrap
|
|
8789
|
+
} },
|
|
8790
|
+
name: "w:textboxTightWrap"
|
|
8791
|
+
}));
|
|
8538
8792
|
if (options.run) this.push(new ParagraphRunProperties(options.run));
|
|
8539
8793
|
if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
|
|
8540
8794
|
}
|
|
@@ -12904,6 +13158,137 @@
|
|
|
12904
13158
|
name: "w:docGrid"
|
|
12905
13159
|
});
|
|
12906
13160
|
//#endregion
|
|
13161
|
+
//#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
|
|
13162
|
+
/**
|
|
13163
|
+
* Footnote and endnote properties module for WordprocessingML section properties.
|
|
13164
|
+
*
|
|
13165
|
+
* Specifies footnote/endnote placement and numbering format within a section.
|
|
13166
|
+
*
|
|
13167
|
+
* Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
|
|
13168
|
+
*
|
|
13169
|
+
* @module
|
|
13170
|
+
*/
|
|
13171
|
+
/**
|
|
13172
|
+
* Creates footnote properties element (w:footnotePr) for a section.
|
|
13173
|
+
*
|
|
13174
|
+
* ## XSD Schema
|
|
13175
|
+
* ```xml
|
|
13176
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
13177
|
+
* <xsd:sequence>
|
|
13178
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
13179
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13180
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13181
|
+
* </xsd:sequence>
|
|
13182
|
+
* </xsd:complexType>
|
|
13183
|
+
* ```
|
|
13184
|
+
*/
|
|
13185
|
+
const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13186
|
+
const container = new FootnoteProperties();
|
|
13187
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13188
|
+
attributes: { val: {
|
|
13189
|
+
key: "w:val",
|
|
13190
|
+
value: pos
|
|
13191
|
+
} },
|
|
13192
|
+
name: "w:pos"
|
|
13193
|
+
}));
|
|
13194
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13195
|
+
attributes: {
|
|
13196
|
+
format: {
|
|
13197
|
+
key: "w:format",
|
|
13198
|
+
value: format
|
|
13199
|
+
},
|
|
13200
|
+
val: {
|
|
13201
|
+
key: "w:fmt",
|
|
13202
|
+
value: formatType
|
|
13203
|
+
}
|
|
13204
|
+
},
|
|
13205
|
+
name: "w:numFmt"
|
|
13206
|
+
}));
|
|
13207
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13208
|
+
attributes: { val: {
|
|
13209
|
+
key: "w:val",
|
|
13210
|
+
value: decimalNumber(numStart)
|
|
13211
|
+
} },
|
|
13212
|
+
name: "w:numStart"
|
|
13213
|
+
}));
|
|
13214
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13215
|
+
attributes: { val: {
|
|
13216
|
+
key: "w:val",
|
|
13217
|
+
value: numRestart
|
|
13218
|
+
} },
|
|
13219
|
+
name: "w:numRestart"
|
|
13220
|
+
}));
|
|
13221
|
+
return container;
|
|
13222
|
+
};
|
|
13223
|
+
/**
|
|
13224
|
+
* Footnote properties container element.
|
|
13225
|
+
*/
|
|
13226
|
+
var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13227
|
+
constructor() {
|
|
13228
|
+
super("w:footnotePr", true);
|
|
13229
|
+
}
|
|
13230
|
+
};
|
|
13231
|
+
/**
|
|
13232
|
+
* Creates endnote properties element (w:endnotePr) for a section.
|
|
13233
|
+
*
|
|
13234
|
+
* ## XSD Schema
|
|
13235
|
+
* ```xml
|
|
13236
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
13237
|
+
* <xsd:sequence>
|
|
13238
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
13239
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13240
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13241
|
+
* </xsd:sequence>
|
|
13242
|
+
* </xsd:complexType>
|
|
13243
|
+
* ```
|
|
13244
|
+
*/
|
|
13245
|
+
const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13246
|
+
const container = new EndnoteProperties();
|
|
13247
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13248
|
+
attributes: { val: {
|
|
13249
|
+
key: "w:val",
|
|
13250
|
+
value: pos
|
|
13251
|
+
} },
|
|
13252
|
+
name: "w:pos"
|
|
13253
|
+
}));
|
|
13254
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13255
|
+
attributes: {
|
|
13256
|
+
format: {
|
|
13257
|
+
key: "w:format",
|
|
13258
|
+
value: format
|
|
13259
|
+
},
|
|
13260
|
+
val: {
|
|
13261
|
+
key: "w:fmt",
|
|
13262
|
+
value: formatType
|
|
13263
|
+
}
|
|
13264
|
+
},
|
|
13265
|
+
name: "w:numFmt"
|
|
13266
|
+
}));
|
|
13267
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13268
|
+
attributes: { val: {
|
|
13269
|
+
key: "w:val",
|
|
13270
|
+
value: decimalNumber(numStart)
|
|
13271
|
+
} },
|
|
13272
|
+
name: "w:numStart"
|
|
13273
|
+
}));
|
|
13274
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13275
|
+
attributes: { val: {
|
|
13276
|
+
key: "w:val",
|
|
13277
|
+
value: numRestart
|
|
13278
|
+
} },
|
|
13279
|
+
name: "w:numRestart"
|
|
13280
|
+
}));
|
|
13281
|
+
return container;
|
|
13282
|
+
};
|
|
13283
|
+
/**
|
|
13284
|
+
* Endnote properties container element.
|
|
13285
|
+
*/
|
|
13286
|
+
var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13287
|
+
constructor() {
|
|
13288
|
+
super("w:endnotePr", true);
|
|
13289
|
+
}
|
|
13290
|
+
};
|
|
13291
|
+
//#endregion
|
|
12907
13292
|
//#region src/file/document/body/section-properties/properties/header-footer-reference.ts
|
|
12908
13293
|
/**
|
|
12909
13294
|
* This simple type specifies the possible types of headers and footers which may be specified for a given header or footer reference in a document. This value determines the page(s) on which the current header or footer shall be displayed.
|
|
@@ -13266,8 +13651,12 @@
|
|
|
13266
13651
|
* });
|
|
13267
13652
|
* ```
|
|
13268
13653
|
*/
|
|
13269
|
-
const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
|
|
13654
|
+
const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
|
|
13270
13655
|
attributes: {
|
|
13656
|
+
chapStyle: {
|
|
13657
|
+
key: "w:chapStyle",
|
|
13658
|
+
value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
|
|
13659
|
+
},
|
|
13271
13660
|
formatType: {
|
|
13272
13661
|
key: "w:fmt",
|
|
13273
13662
|
value: formatType
|
|
@@ -13556,7 +13945,7 @@
|
|
|
13556
13945
|
* ```
|
|
13557
13946
|
*/
|
|
13558
13947
|
var SectionProperties = class extends XmlComponent {
|
|
13559
|
-
constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision } = {}) {
|
|
13948
|
+
constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision, noEndnote, bidi, rtlGutter, paperSrc, footnotePr, endnotePr } = {}) {
|
|
13560
13949
|
super("w:sectPr");
|
|
13561
13950
|
this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
|
|
13562
13951
|
this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
|
|
@@ -13575,6 +13964,24 @@
|
|
|
13575
13964
|
if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
|
|
13576
13965
|
if (textDirection) this.root.push(new PageTextDirection(textDirection));
|
|
13577
13966
|
if (revision) this.root.push(new SectionPropertiesChange(revision));
|
|
13967
|
+
if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
|
|
13968
|
+
if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
|
|
13969
|
+
if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
|
|
13970
|
+
if (paperSrc) this.root.push(new BuilderElement({
|
|
13971
|
+
attributes: {
|
|
13972
|
+
first: {
|
|
13973
|
+
key: "w:first",
|
|
13974
|
+
value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
|
|
13975
|
+
},
|
|
13976
|
+
other: {
|
|
13977
|
+
key: "w:other",
|
|
13978
|
+
value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
|
|
13979
|
+
}
|
|
13980
|
+
},
|
|
13981
|
+
name: "w:paperSrc"
|
|
13982
|
+
}));
|
|
13983
|
+
if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
|
|
13984
|
+
if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
|
|
13578
13985
|
this.root.push(createDocumentGrid({
|
|
13579
13986
|
charSpace,
|
|
13580
13987
|
linePitch,
|
|
@@ -21711,13 +22118,12 @@
|
|
|
21711
22118
|
const footerFormattedViews = /* @__PURE__ */ new Map();
|
|
21712
22119
|
const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
|
|
21713
22120
|
const map = new Map(Object.entries(xmlifiedFileMapping));
|
|
21714
|
-
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] =
|
|
21715
|
-
else files[obj.path] =
|
|
21716
|
-
for (const subFile of overrides) files[subFile.path] =
|
|
21717
|
-
for (const mediaData of file.Media.Array)
|
|
21718
|
-
else {
|
|
22121
|
+
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22122
|
+
else files[obj.path] = (0, undio.textToUint8Array)(obj.data);
|
|
22123
|
+
for (const subFile of overrides) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22124
|
+
for (const mediaData of file.Media.Array) {
|
|
21719
22125
|
files[`word/media/${mediaData.fileName}`] = [(0, undio.toUint8Array)(mediaData.data), { level: 0 }];
|
|
21720
|
-
files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
22126
|
+
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
21721
22127
|
}
|
|
21722
22128
|
for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
|
|
21723
22129
|
const [nameWithoutExtension] = name.split(".");
|
|
@@ -23253,13 +23659,17 @@
|
|
|
23253
23659
|
exports.TableRow = TableRow;
|
|
23254
23660
|
exports.TableRowProperties = TableRowProperties;
|
|
23255
23661
|
exports.TableRowPropertiesChange = TableRowPropertiesChange;
|
|
23662
|
+
exports.TextAlignmentType = TextAlignmentType;
|
|
23256
23663
|
exports.TextDirection = TextDirection;
|
|
23257
23664
|
exports.TextEffect = TextEffect;
|
|
23258
23665
|
exports.TextRun = TextRun;
|
|
23259
23666
|
exports.TextWrappingSide = TextWrappingSide;
|
|
23260
23667
|
exports.TextWrappingType = TextWrappingType;
|
|
23261
23668
|
exports.Textbox = Textbox;
|
|
23669
|
+
exports.TextboxTightWrapType = TextboxTightWrapType;
|
|
23262
23670
|
exports.ThematicBreak = ThematicBreak;
|
|
23671
|
+
exports.ThemeColor = ThemeColor;
|
|
23672
|
+
exports.ThemeFont = ThemeFont;
|
|
23263
23673
|
exports.UnderlineType = UnderlineType;
|
|
23264
23674
|
exports.VerticalAlign = VerticalAlign;
|
|
23265
23675
|
exports.VerticalAlignSection = VerticalAlignSection;
|
|
@@ -23338,7 +23748,6 @@
|
|
|
23338
23748
|
exports.decimalNumber = decimalNumber;
|
|
23339
23749
|
exports.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
|
|
23340
23750
|
exports.eighthPointMeasureValue = eighthPointMeasureValue;
|
|
23341
|
-
exports.encodeUtf8 = encodeUtf8;
|
|
23342
23751
|
exports.hashedId = hashedId;
|
|
23343
23752
|
exports.hexColorValue = hexColorValue;
|
|
23344
23753
|
exports.hpsMeasureValue = hpsMeasureValue;
|