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.iife.js
CHANGED
|
@@ -384,6 +384,9 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
384
384
|
rsidSect: "w:rsidSect",
|
|
385
385
|
space: "w:space",
|
|
386
386
|
sz: "w:sz",
|
|
387
|
+
themeColor: "w:themeColor",
|
|
388
|
+
themeShade: "w:themeShade",
|
|
389
|
+
themeTint: "w:themeTint",
|
|
387
390
|
top: "w:top",
|
|
388
391
|
type: "w:type",
|
|
389
392
|
val: "w:val",
|
|
@@ -910,6 +913,49 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
910
913
|
* ```
|
|
911
914
|
*/
|
|
912
915
|
const dateTimeValue = (val) => val.toISOString();
|
|
916
|
+
/**
|
|
917
|
+
* Theme color values used throughout OOXML for referencing document theme colors.
|
|
918
|
+
*
|
|
919
|
+
* Reference: ST_ThemeColor in OOXML specification
|
|
920
|
+
*
|
|
921
|
+
* @publicApi
|
|
922
|
+
*/
|
|
923
|
+
const ThemeColor = {
|
|
924
|
+
DARK1: "dark1",
|
|
925
|
+
LIGHT1: "light1",
|
|
926
|
+
DARK2: "dark2",
|
|
927
|
+
LIGHT2: "light2",
|
|
928
|
+
ACCENT1: "accent1",
|
|
929
|
+
ACCENT2: "accent2",
|
|
930
|
+
ACCENT3: "accent3",
|
|
931
|
+
ACCENT4: "accent4",
|
|
932
|
+
ACCENT5: "accent5",
|
|
933
|
+
ACCENT6: "accent6",
|
|
934
|
+
HYPERLINK: "hyperlink",
|
|
935
|
+
FOLLOWED_HYPERLINK: "followedHyperlink",
|
|
936
|
+
NONE: "none",
|
|
937
|
+
BACKGROUND1: "background1",
|
|
938
|
+
TEXT1: "text1",
|
|
939
|
+
BACKGROUND2: "background2",
|
|
940
|
+
TEXT2: "text2"
|
|
941
|
+
};
|
|
942
|
+
/**
|
|
943
|
+
* Theme font values used for referencing document theme fonts.
|
|
944
|
+
*
|
|
945
|
+
* Reference: ST_Theme in OOXML specification
|
|
946
|
+
*
|
|
947
|
+
* @publicApi
|
|
948
|
+
*/
|
|
949
|
+
const ThemeFont = {
|
|
950
|
+
MAJOR_EAST_ASIA: "majorEastAsia",
|
|
951
|
+
MAJOR_BIDI: "majorBidi",
|
|
952
|
+
MAJOR_ASCII: "majorAscii",
|
|
953
|
+
MAJOR_H_ANSI: "majorHAnsi",
|
|
954
|
+
MINOR_EAST_ASIA: "minorEastAsia",
|
|
955
|
+
MINOR_BIDI: "minorBidi",
|
|
956
|
+
MINOR_ASCII: "minorAscii",
|
|
957
|
+
MINOR_H_ANSI: "minorHAnsi"
|
|
958
|
+
};
|
|
913
959
|
//#endregion
|
|
914
960
|
//#region src/file/xml-components/simple-elements.ts
|
|
915
961
|
/**
|
|
@@ -1322,12 +1368,20 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
1322
1368
|
* });
|
|
1323
1369
|
* ```
|
|
1324
1370
|
*/
|
|
1325
|
-
const createBorderElement = (elementName, { color, size, space, style }) => new BuilderElement({
|
|
1371
|
+
const createBorderElement = (elementName, { color, size, space, style, themeColor, themeTint, themeShade, shadow, frame }) => new BuilderElement({
|
|
1326
1372
|
attributes: {
|
|
1327
1373
|
color: {
|
|
1328
1374
|
key: "w:color",
|
|
1329
1375
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
1330
1376
|
},
|
|
1377
|
+
frame: {
|
|
1378
|
+
key: "w:frame",
|
|
1379
|
+
value: frame
|
|
1380
|
+
},
|
|
1381
|
+
shadow: {
|
|
1382
|
+
key: "w:shadow",
|
|
1383
|
+
value: shadow
|
|
1384
|
+
},
|
|
1331
1385
|
size: {
|
|
1332
1386
|
key: "w:sz",
|
|
1333
1387
|
value: size === void 0 ? void 0 : eighthPointMeasureValue(size)
|
|
@@ -1339,6 +1393,18 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
1339
1393
|
style: {
|
|
1340
1394
|
key: "w:val",
|
|
1341
1395
|
value: style
|
|
1396
|
+
},
|
|
1397
|
+
themeColor: {
|
|
1398
|
+
key: "w:themeColor",
|
|
1399
|
+
value: themeColor
|
|
1400
|
+
},
|
|
1401
|
+
themeShade: {
|
|
1402
|
+
key: "w:themeShade",
|
|
1403
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
1404
|
+
},
|
|
1405
|
+
themeTint: {
|
|
1406
|
+
key: "w:themeTint",
|
|
1407
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
1342
1408
|
}
|
|
1343
1409
|
},
|
|
1344
1410
|
name: elementName
|
|
@@ -1542,20 +1608,32 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
1542
1608
|
* </xsd:complexType>
|
|
1543
1609
|
* ```
|
|
1544
1610
|
*/
|
|
1545
|
-
const createIndent = ({ start, end, left, right, hanging, firstLine }) => new BuilderElement({
|
|
1611
|
+
const createIndent = ({ start, startChars, end, endChars, left, right, hanging, hangingChars, firstLine, firstLineChars }) => new BuilderElement({
|
|
1546
1612
|
attributes: {
|
|
1547
1613
|
end: {
|
|
1548
1614
|
key: "w:end",
|
|
1549
1615
|
value: end === void 0 ? void 0 : signedTwipsMeasureValue(end)
|
|
1550
1616
|
},
|
|
1617
|
+
endChars: {
|
|
1618
|
+
key: "w:endChars",
|
|
1619
|
+
value: endChars === void 0 ? void 0 : decimalNumber(endChars)
|
|
1620
|
+
},
|
|
1551
1621
|
firstLine: {
|
|
1552
1622
|
key: "w:firstLine",
|
|
1553
1623
|
value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine)
|
|
1554
1624
|
},
|
|
1625
|
+
firstLineChars: {
|
|
1626
|
+
key: "w:firstLineChars",
|
|
1627
|
+
value: firstLineChars === void 0 ? void 0 : decimalNumber(firstLineChars)
|
|
1628
|
+
},
|
|
1555
1629
|
hanging: {
|
|
1556
1630
|
key: "w:hanging",
|
|
1557
1631
|
value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging)
|
|
1558
1632
|
},
|
|
1633
|
+
hangingChars: {
|
|
1634
|
+
key: "w:hangingChars",
|
|
1635
|
+
value: hangingChars === void 0 ? void 0 : decimalNumber(hangingChars)
|
|
1636
|
+
},
|
|
1559
1637
|
left: {
|
|
1560
1638
|
key: "w:left",
|
|
1561
1639
|
value: left === void 0 ? void 0 : signedTwipsMeasureValue(left)
|
|
@@ -1567,6 +1645,10 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
1567
1645
|
start: {
|
|
1568
1646
|
key: "w:start",
|
|
1569
1647
|
value: start === void 0 ? void 0 : signedTwipsMeasureValue(start)
|
|
1648
|
+
},
|
|
1649
|
+
startChars: {
|
|
1650
|
+
key: "w:startChars",
|
|
1651
|
+
value: startChars === void 0 ? void 0 : decimalNumber(startChars)
|
|
1570
1652
|
}
|
|
1571
1653
|
},
|
|
1572
1654
|
name: "w:ind"
|
|
@@ -2017,7 +2099,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2017
2099
|
*
|
|
2018
2100
|
* Reference: http://officeopenxml.com/WPshading.php
|
|
2019
2101
|
*/
|
|
2020
|
-
const createShading = ({ fill, color, type }) => new BuilderElement({
|
|
2102
|
+
const createShading = ({ fill, color, type, themeColor, themeTint, themeShade, themeFill, themeFillTint, themeFillShade }) => new BuilderElement({
|
|
2021
2103
|
attributes: {
|
|
2022
2104
|
color: {
|
|
2023
2105
|
key: "w:color",
|
|
@@ -2027,6 +2109,30 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2027
2109
|
key: "w:fill",
|
|
2028
2110
|
value: fill === void 0 ? void 0 : hexColorValue(fill)
|
|
2029
2111
|
},
|
|
2112
|
+
themeColor: {
|
|
2113
|
+
key: "w:themeColor",
|
|
2114
|
+
value: themeColor
|
|
2115
|
+
},
|
|
2116
|
+
themeFill: {
|
|
2117
|
+
key: "w:themeFill",
|
|
2118
|
+
value: themeFill
|
|
2119
|
+
},
|
|
2120
|
+
themeFillShade: {
|
|
2121
|
+
key: "w:themeFillShade",
|
|
2122
|
+
value: themeFillShade === void 0 ? void 0 : uCharHexNumber(themeFillShade)
|
|
2123
|
+
},
|
|
2124
|
+
themeFillTint: {
|
|
2125
|
+
key: "w:themeFillTint",
|
|
2126
|
+
value: themeFillTint === void 0 ? void 0 : uCharHexNumber(themeFillTint)
|
|
2127
|
+
},
|
|
2128
|
+
themeShade: {
|
|
2129
|
+
key: "w:themeShade",
|
|
2130
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2131
|
+
},
|
|
2132
|
+
themeTint: {
|
|
2133
|
+
key: "w:themeTint",
|
|
2134
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2135
|
+
},
|
|
2030
2136
|
type: {
|
|
2031
2137
|
key: "w:val",
|
|
2032
2138
|
value: type
|
|
@@ -2173,6 +2279,57 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2173
2279
|
}
|
|
2174
2280
|
};
|
|
2175
2281
|
//#endregion
|
|
2282
|
+
//#region src/file/paragraph/run/east-asian-layout.ts
|
|
2283
|
+
/**
|
|
2284
|
+
* East Asian layout module for WordprocessingML run properties.
|
|
2285
|
+
*
|
|
2286
|
+
* Specifies East Asian typography settings for a run, including
|
|
2287
|
+
* character combination, vertical text, and compression.
|
|
2288
|
+
*
|
|
2289
|
+
* Reference: ISO/IEC 29500-4, CT_EastAsianLayout
|
|
2290
|
+
*
|
|
2291
|
+
* @module
|
|
2292
|
+
*/
|
|
2293
|
+
/**
|
|
2294
|
+
* Creates an East Asian layout element (w:eastAsianLayout) for a run.
|
|
2295
|
+
*
|
|
2296
|
+
* ## XSD Schema
|
|
2297
|
+
* ```xml
|
|
2298
|
+
* <xsd:complexType name="CT_EastAsianLayout">
|
|
2299
|
+
* <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
|
|
2300
|
+
* <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
|
|
2301
|
+
* <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
|
|
2302
|
+
* <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
|
|
2303
|
+
* <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
|
|
2304
|
+
* </xsd:complexType>
|
|
2305
|
+
* ```
|
|
2306
|
+
*/
|
|
2307
|
+
const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
|
|
2308
|
+
attributes: {
|
|
2309
|
+
combine: {
|
|
2310
|
+
key: "w:combine",
|
|
2311
|
+
value: combine
|
|
2312
|
+
},
|
|
2313
|
+
combineBrackets: {
|
|
2314
|
+
key: "w:combineBrackets",
|
|
2315
|
+
value: combineBrackets
|
|
2316
|
+
},
|
|
2317
|
+
id: {
|
|
2318
|
+
key: "w:id",
|
|
2319
|
+
value: id === void 0 ? void 0 : decimalNumber(id)
|
|
2320
|
+
},
|
|
2321
|
+
vert: {
|
|
2322
|
+
key: "w:vert",
|
|
2323
|
+
value: vert
|
|
2324
|
+
},
|
|
2325
|
+
vertCompress: {
|
|
2326
|
+
key: "w:vertCompress",
|
|
2327
|
+
value: vertCompress
|
|
2328
|
+
}
|
|
2329
|
+
},
|
|
2330
|
+
name: "w:eastAsianLayout"
|
|
2331
|
+
});
|
|
2332
|
+
//#endregion
|
|
2176
2333
|
//#region src/file/paragraph/run/emphasis-mark.ts
|
|
2177
2334
|
/**
|
|
2178
2335
|
* Emphasis mark module for WordprocessingML run properties.
|
|
@@ -2205,7 +2362,13 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2205
2362
|
*
|
|
2206
2363
|
* @publicApi
|
|
2207
2364
|
*/
|
|
2208
|
-
const EmphasisMarkType = {
|
|
2365
|
+
const EmphasisMarkType = {
|
|
2366
|
+
NONE: "none",
|
|
2367
|
+
COMMA: "comma",
|
|
2368
|
+
CIRCLE: "circle",
|
|
2369
|
+
DOT: "dot",
|
|
2370
|
+
UNDER_DOT: "underDot"
|
|
2371
|
+
};
|
|
2209
2372
|
/**
|
|
2210
2373
|
* Creates an emphasis mark element for a WordprocessingML document.
|
|
2211
2374
|
*
|
|
@@ -2296,16 +2459,27 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2296
2459
|
*
|
|
2297
2460
|
* @example
|
|
2298
2461
|
* ```typescript
|
|
2299
|
-
* new Color("FF0000"); // Red text
|
|
2462
|
+
* new Color("FF0000"); // Red text (backward compatible)
|
|
2300
2463
|
* new Color("auto"); // Automatic color
|
|
2464
|
+
* new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
|
|
2301
2465
|
* ```
|
|
2302
2466
|
*
|
|
2303
2467
|
* @internal
|
|
2304
2468
|
*/
|
|
2305
2469
|
var Color = class extends XmlComponent {
|
|
2306
|
-
constructor(
|
|
2470
|
+
constructor(colorOrOptions) {
|
|
2307
2471
|
super("w:color");
|
|
2308
|
-
|
|
2472
|
+
if (typeof colorOrOptions === "string") {
|
|
2473
|
+
this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
const opts = colorOrOptions;
|
|
2477
|
+
this.root.push(new Attributes({
|
|
2478
|
+
val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
|
|
2479
|
+
themeColor: opts.themeColor,
|
|
2480
|
+
themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
|
|
2481
|
+
themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
|
|
2482
|
+
}));
|
|
2309
2483
|
}
|
|
2310
2484
|
};
|
|
2311
2485
|
/**
|
|
@@ -2504,18 +2678,34 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2504
2678
|
key: "w:ascii",
|
|
2505
2679
|
value: attrs.ascii
|
|
2506
2680
|
},
|
|
2681
|
+
asciiTheme: {
|
|
2682
|
+
key: "w:asciiTheme",
|
|
2683
|
+
value: attrs.asciiTheme
|
|
2684
|
+
},
|
|
2507
2685
|
cs: {
|
|
2508
2686
|
key: "w:cs",
|
|
2509
2687
|
value: attrs.cs
|
|
2510
2688
|
},
|
|
2689
|
+
cstheme: {
|
|
2690
|
+
key: "w:cstheme",
|
|
2691
|
+
value: attrs.cstheme
|
|
2692
|
+
},
|
|
2511
2693
|
eastAsia: {
|
|
2512
2694
|
key: "w:eastAsia",
|
|
2513
2695
|
value: attrs.eastAsia
|
|
2514
2696
|
},
|
|
2697
|
+
eastAsiaTheme: {
|
|
2698
|
+
key: "w:eastAsiaTheme",
|
|
2699
|
+
value: attrs.eastAsiaTheme
|
|
2700
|
+
},
|
|
2515
2701
|
hAnsi: {
|
|
2516
2702
|
key: "w:hAnsi",
|
|
2517
2703
|
value: attrs.hAnsi
|
|
2518
2704
|
},
|
|
2705
|
+
hAnsiTheme: {
|
|
2706
|
+
key: "w:hAnsiTheme",
|
|
2707
|
+
value: attrs.hAnsiTheme
|
|
2708
|
+
},
|
|
2519
2709
|
hint: {
|
|
2520
2710
|
key: "w:hint",
|
|
2521
2711
|
value: attrs.hint
|
|
@@ -2672,12 +2862,24 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2672
2862
|
* createUnderline(UnderlineType.WAVE, "FF0000");
|
|
2673
2863
|
* ```
|
|
2674
2864
|
*/
|
|
2675
|
-
const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
|
|
2865
|
+
const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
|
|
2676
2866
|
attributes: {
|
|
2677
2867
|
color: {
|
|
2678
2868
|
key: "w:color",
|
|
2679
2869
|
value: color === void 0 ? void 0 : hexColorValue(color)
|
|
2680
2870
|
},
|
|
2871
|
+
themeColor: {
|
|
2872
|
+
key: "w:themeColor",
|
|
2873
|
+
value: themeColor
|
|
2874
|
+
},
|
|
2875
|
+
themeShade: {
|
|
2876
|
+
key: "w:themeShade",
|
|
2877
|
+
value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
|
|
2878
|
+
},
|
|
2879
|
+
themeTint: {
|
|
2880
|
+
key: "w:themeTint",
|
|
2881
|
+
value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
|
|
2882
|
+
},
|
|
2681
2883
|
val: {
|
|
2682
2884
|
key: "w:val",
|
|
2683
2885
|
value: underlineType
|
|
@@ -2829,6 +3031,9 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2829
3031
|
if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
|
|
2830
3032
|
if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
|
|
2831
3033
|
if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
|
|
3034
|
+
if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
|
|
3035
|
+
if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
|
|
3036
|
+
if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
|
|
2832
3037
|
if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
|
|
2833
3038
|
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
2834
3039
|
if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
|
|
@@ -2854,6 +3059,9 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
2854
3059
|
if (options.language) this.push(createLanguageComponent(options.language));
|
|
2855
3060
|
if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
|
|
2856
3061
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
3062
|
+
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
3063
|
+
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
3064
|
+
if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
|
|
2857
3065
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
2858
3066
|
}
|
|
2859
3067
|
push(item) {
|
|
@@ -3289,18 +3497,6 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
3289
3497
|
* ```
|
|
3290
3498
|
*/
|
|
3291
3499
|
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
3292
|
-
/**
|
|
3293
|
-
* Encode a string to UTF-8 bytes.
|
|
3294
|
-
*
|
|
3295
|
-
* This is used to pre-encode XML content before passing to fflate's zipSync,
|
|
3296
|
-
* which expects Uint8Array input for text content.
|
|
3297
|
-
*
|
|
3298
|
-
* The copy via `new Uint8Array()` ensures the returned array uses the
|
|
3299
|
-
* current module's Uint8Array constructor, avoiding cross-realm issues
|
|
3300
|
-
* in test environments (happy-dom) where TextEncoder returns a different
|
|
3301
|
-
* realm's Uint8Array.
|
|
3302
|
-
*/
|
|
3303
|
-
const encodeUtf8 = (str) => new Uint8Array(new TextEncoder().encode(str));
|
|
3304
3500
|
//#endregion
|
|
3305
3501
|
//#region src/file/drawing/floating/floating-position.ts
|
|
3306
3502
|
/**
|
|
@@ -6963,7 +7159,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
6963
7159
|
* });
|
|
6964
7160
|
* ```
|
|
6965
7161
|
*/
|
|
6966
|
-
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
|
|
7162
|
+
const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
|
|
6967
7163
|
attributes: {
|
|
6968
7164
|
after: {
|
|
6969
7165
|
key: "w:after",
|
|
@@ -6973,6 +7169,10 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
6973
7169
|
key: "w:afterAutospacing",
|
|
6974
7170
|
value: afterAutoSpacing
|
|
6975
7171
|
},
|
|
7172
|
+
afterLines: {
|
|
7173
|
+
key: "w:afterLines",
|
|
7174
|
+
value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
|
|
7175
|
+
},
|
|
6976
7176
|
before: {
|
|
6977
7177
|
key: "w:before",
|
|
6978
7178
|
value: before
|
|
@@ -6981,6 +7181,10 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
6981
7181
|
key: "w:beforeAutospacing",
|
|
6982
7182
|
value: beforeAutoSpacing
|
|
6983
7183
|
},
|
|
7184
|
+
beforeLines: {
|
|
7185
|
+
key: "w:beforeLines",
|
|
7186
|
+
value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
|
|
7187
|
+
},
|
|
6984
7188
|
line: {
|
|
6985
7189
|
key: "w:line",
|
|
6986
7190
|
value: line
|
|
@@ -7091,6 +7295,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
7091
7295
|
*/
|
|
7092
7296
|
const LeaderType = {
|
|
7093
7297
|
DOT: "dot",
|
|
7298
|
+
HEAVY: "heavy",
|
|
7094
7299
|
HYPHEN: "hyphen",
|
|
7095
7300
|
MIDDLE_DOT: "middleDot",
|
|
7096
7301
|
NONE: "none",
|
|
@@ -8363,6 +8568,34 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
8363
8568
|
* @module
|
|
8364
8569
|
*/
|
|
8365
8570
|
/**
|
|
8571
|
+
* Vertical text alignment types for paragraphs.
|
|
8572
|
+
*
|
|
8573
|
+
* Specifies the vertical alignment of text within the paragraph.
|
|
8574
|
+
*
|
|
8575
|
+
* @publicApi
|
|
8576
|
+
*/
|
|
8577
|
+
const TextAlignmentType = {
|
|
8578
|
+
TOP: "top",
|
|
8579
|
+
CENTER: "center",
|
|
8580
|
+
BASELINE: "baseline",
|
|
8581
|
+
BOTTOM: "bottom",
|
|
8582
|
+
AUTO: "auto"
|
|
8583
|
+
};
|
|
8584
|
+
/**
|
|
8585
|
+
* Textbox tight wrap types for paragraphs.
|
|
8586
|
+
*
|
|
8587
|
+
* Specifies how tightly text wraps around a textbox.
|
|
8588
|
+
*
|
|
8589
|
+
* @publicApi
|
|
8590
|
+
*/
|
|
8591
|
+
const TextboxTightWrapType = {
|
|
8592
|
+
NONE: "none",
|
|
8593
|
+
ALL_LINES: "allLines",
|
|
8594
|
+
FIRST_AND_LAST_LINE: "firstAndLastLine",
|
|
8595
|
+
FIRST_LINE_ONLY: "firstLineOnly",
|
|
8596
|
+
LAST_LINE_ONLY: "lastLineOnly"
|
|
8597
|
+
};
|
|
8598
|
+
/**
|
|
8366
8599
|
* Represents paragraph properties (pPr) in a WordprocessingML document.
|
|
8367
8600
|
*
|
|
8368
8601
|
* The paragraph properties element specifies all formatting applied to a paragraph,
|
|
@@ -8525,6 +8758,27 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
8525
8758
|
if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
|
|
8526
8759
|
if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
8527
8760
|
if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
8761
|
+
if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
8762
|
+
if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
|
|
8763
|
+
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
8764
|
+
if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
|
|
8765
|
+
if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
|
|
8766
|
+
if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
|
|
8767
|
+
if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
|
|
8768
|
+
if (options.textAlignment !== void 0) this.push(new BuilderElement({
|
|
8769
|
+
attributes: { val: {
|
|
8770
|
+
key: "w:val",
|
|
8771
|
+
value: options.textAlignment
|
|
8772
|
+
} },
|
|
8773
|
+
name: "w:textAlignment"
|
|
8774
|
+
}));
|
|
8775
|
+
if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
|
|
8776
|
+
attributes: { val: {
|
|
8777
|
+
key: "w:val",
|
|
8778
|
+
value: options.textboxTightWrap
|
|
8779
|
+
} },
|
|
8780
|
+
name: "w:textboxTightWrap"
|
|
8781
|
+
}));
|
|
8528
8782
|
if (options.run) this.push(new ParagraphRunProperties(options.run));
|
|
8529
8783
|
if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
|
|
8530
8784
|
}
|
|
@@ -12894,6 +13148,137 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
12894
13148
|
name: "w:docGrid"
|
|
12895
13149
|
});
|
|
12896
13150
|
//#endregion
|
|
13151
|
+
//#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
|
|
13152
|
+
/**
|
|
13153
|
+
* Footnote and endnote properties module for WordprocessingML section properties.
|
|
13154
|
+
*
|
|
13155
|
+
* Specifies footnote/endnote placement and numbering format within a section.
|
|
13156
|
+
*
|
|
13157
|
+
* Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
|
|
13158
|
+
*
|
|
13159
|
+
* @module
|
|
13160
|
+
*/
|
|
13161
|
+
/**
|
|
13162
|
+
* Creates footnote properties element (w:footnotePr) for a section.
|
|
13163
|
+
*
|
|
13164
|
+
* ## XSD Schema
|
|
13165
|
+
* ```xml
|
|
13166
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
13167
|
+
* <xsd:sequence>
|
|
13168
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
13169
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13170
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13171
|
+
* </xsd:sequence>
|
|
13172
|
+
* </xsd:complexType>
|
|
13173
|
+
* ```
|
|
13174
|
+
*/
|
|
13175
|
+
const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13176
|
+
const container = new FootnoteProperties();
|
|
13177
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13178
|
+
attributes: { val: {
|
|
13179
|
+
key: "w:val",
|
|
13180
|
+
value: pos
|
|
13181
|
+
} },
|
|
13182
|
+
name: "w:pos"
|
|
13183
|
+
}));
|
|
13184
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13185
|
+
attributes: {
|
|
13186
|
+
format: {
|
|
13187
|
+
key: "w:format",
|
|
13188
|
+
value: format
|
|
13189
|
+
},
|
|
13190
|
+
val: {
|
|
13191
|
+
key: "w:fmt",
|
|
13192
|
+
value: formatType
|
|
13193
|
+
}
|
|
13194
|
+
},
|
|
13195
|
+
name: "w:numFmt"
|
|
13196
|
+
}));
|
|
13197
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13198
|
+
attributes: { val: {
|
|
13199
|
+
key: "w:val",
|
|
13200
|
+
value: decimalNumber(numStart)
|
|
13201
|
+
} },
|
|
13202
|
+
name: "w:numStart"
|
|
13203
|
+
}));
|
|
13204
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13205
|
+
attributes: { val: {
|
|
13206
|
+
key: "w:val",
|
|
13207
|
+
value: numRestart
|
|
13208
|
+
} },
|
|
13209
|
+
name: "w:numRestart"
|
|
13210
|
+
}));
|
|
13211
|
+
return container;
|
|
13212
|
+
};
|
|
13213
|
+
/**
|
|
13214
|
+
* Footnote properties container element.
|
|
13215
|
+
*/
|
|
13216
|
+
var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13217
|
+
constructor() {
|
|
13218
|
+
super("w:footnotePr", true);
|
|
13219
|
+
}
|
|
13220
|
+
};
|
|
13221
|
+
/**
|
|
13222
|
+
* Creates endnote properties element (w:endnotePr) for a section.
|
|
13223
|
+
*
|
|
13224
|
+
* ## XSD Schema
|
|
13225
|
+
* ```xml
|
|
13226
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
13227
|
+
* <xsd:sequence>
|
|
13228
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
13229
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
13230
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
13231
|
+
* </xsd:sequence>
|
|
13232
|
+
* </xsd:complexType>
|
|
13233
|
+
* ```
|
|
13234
|
+
*/
|
|
13235
|
+
const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
13236
|
+
const container = new EndnoteProperties();
|
|
13237
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
13238
|
+
attributes: { val: {
|
|
13239
|
+
key: "w:val",
|
|
13240
|
+
value: pos
|
|
13241
|
+
} },
|
|
13242
|
+
name: "w:pos"
|
|
13243
|
+
}));
|
|
13244
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
13245
|
+
attributes: {
|
|
13246
|
+
format: {
|
|
13247
|
+
key: "w:format",
|
|
13248
|
+
value: format
|
|
13249
|
+
},
|
|
13250
|
+
val: {
|
|
13251
|
+
key: "w:fmt",
|
|
13252
|
+
value: formatType
|
|
13253
|
+
}
|
|
13254
|
+
},
|
|
13255
|
+
name: "w:numFmt"
|
|
13256
|
+
}));
|
|
13257
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
13258
|
+
attributes: { val: {
|
|
13259
|
+
key: "w:val",
|
|
13260
|
+
value: decimalNumber(numStart)
|
|
13261
|
+
} },
|
|
13262
|
+
name: "w:numStart"
|
|
13263
|
+
}));
|
|
13264
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
13265
|
+
attributes: { val: {
|
|
13266
|
+
key: "w:val",
|
|
13267
|
+
value: numRestart
|
|
13268
|
+
} },
|
|
13269
|
+
name: "w:numRestart"
|
|
13270
|
+
}));
|
|
13271
|
+
return container;
|
|
13272
|
+
};
|
|
13273
|
+
/**
|
|
13274
|
+
* Endnote properties container element.
|
|
13275
|
+
*/
|
|
13276
|
+
var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
13277
|
+
constructor() {
|
|
13278
|
+
super("w:endnotePr", true);
|
|
13279
|
+
}
|
|
13280
|
+
};
|
|
13281
|
+
//#endregion
|
|
12897
13282
|
//#region src/file/document/body/section-properties/properties/header-footer-reference.ts
|
|
12898
13283
|
/**
|
|
12899
13284
|
* 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.
|
|
@@ -13256,8 +13641,12 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
13256
13641
|
* });
|
|
13257
13642
|
* ```
|
|
13258
13643
|
*/
|
|
13259
|
-
const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
|
|
13644
|
+
const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
|
|
13260
13645
|
attributes: {
|
|
13646
|
+
chapStyle: {
|
|
13647
|
+
key: "w:chapStyle",
|
|
13648
|
+
value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
|
|
13649
|
+
},
|
|
13261
13650
|
formatType: {
|
|
13262
13651
|
key: "w:fmt",
|
|
13263
13652
|
value: formatType
|
|
@@ -13546,7 +13935,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
13546
13935
|
* ```
|
|
13547
13936
|
*/
|
|
13548
13937
|
var SectionProperties = class extends XmlComponent {
|
|
13549
|
-
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 } = {}) {
|
|
13938
|
+
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 } = {}) {
|
|
13550
13939
|
super("w:sectPr");
|
|
13551
13940
|
this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
|
|
13552
13941
|
this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
|
|
@@ -13565,6 +13954,24 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
13565
13954
|
if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
|
|
13566
13955
|
if (textDirection) this.root.push(new PageTextDirection(textDirection));
|
|
13567
13956
|
if (revision) this.root.push(new SectionPropertiesChange(revision));
|
|
13957
|
+
if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
|
|
13958
|
+
if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
|
|
13959
|
+
if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
|
|
13960
|
+
if (paperSrc) this.root.push(new BuilderElement({
|
|
13961
|
+
attributes: {
|
|
13962
|
+
first: {
|
|
13963
|
+
key: "w:first",
|
|
13964
|
+
value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
|
|
13965
|
+
},
|
|
13966
|
+
other: {
|
|
13967
|
+
key: "w:other",
|
|
13968
|
+
value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
|
|
13969
|
+
}
|
|
13970
|
+
},
|
|
13971
|
+
name: "w:paperSrc"
|
|
13972
|
+
}));
|
|
13973
|
+
if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
|
|
13974
|
+
if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
|
|
13568
13975
|
this.root.push(createDocumentGrid({
|
|
13569
13976
|
charSpace,
|
|
13570
13977
|
linePitch,
|
|
@@ -21701,13 +22108,12 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
21701
22108
|
const footerFormattedViews = /* @__PURE__ */ new Map();
|
|
21702
22109
|
const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
|
|
21703
22110
|
const map = new Map(Object.entries(xmlifiedFileMapping));
|
|
21704
|
-
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] =
|
|
21705
|
-
else files[obj.path] =
|
|
21706
|
-
for (const subFile of overrides) files[subFile.path] =
|
|
21707
|
-
for (const mediaData of file.Media.Array)
|
|
21708
|
-
else {
|
|
22111
|
+
for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22112
|
+
else files[obj.path] = (0, undio.textToUint8Array)(obj.data);
|
|
22113
|
+
for (const subFile of overrides) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
|
|
22114
|
+
for (const mediaData of file.Media.Array) {
|
|
21709
22115
|
files[`word/media/${mediaData.fileName}`] = [(0, undio.toUint8Array)(mediaData.data), { level: 0 }];
|
|
21710
|
-
files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
22116
|
+
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
|
|
21711
22117
|
}
|
|
21712
22118
|
for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
|
|
21713
22119
|
const [nameWithoutExtension] = name.split(".");
|
|
@@ -23243,13 +23649,17 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
23243
23649
|
exports.TableRow = TableRow;
|
|
23244
23650
|
exports.TableRowProperties = TableRowProperties;
|
|
23245
23651
|
exports.TableRowPropertiesChange = TableRowPropertiesChange;
|
|
23652
|
+
exports.TextAlignmentType = TextAlignmentType;
|
|
23246
23653
|
exports.TextDirection = TextDirection;
|
|
23247
23654
|
exports.TextEffect = TextEffect;
|
|
23248
23655
|
exports.TextRun = TextRun;
|
|
23249
23656
|
exports.TextWrappingSide = TextWrappingSide;
|
|
23250
23657
|
exports.TextWrappingType = TextWrappingType;
|
|
23251
23658
|
exports.Textbox = Textbox;
|
|
23659
|
+
exports.TextboxTightWrapType = TextboxTightWrapType;
|
|
23252
23660
|
exports.ThematicBreak = ThematicBreak;
|
|
23661
|
+
exports.ThemeColor = ThemeColor;
|
|
23662
|
+
exports.ThemeFont = ThemeFont;
|
|
23253
23663
|
exports.UnderlineType = UnderlineType;
|
|
23254
23664
|
exports.VerticalAlign = VerticalAlign;
|
|
23255
23665
|
exports.VerticalAlignSection = VerticalAlignSection;
|
|
@@ -23328,7 +23738,6 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
23328
23738
|
exports.decimalNumber = decimalNumber;
|
|
23329
23739
|
exports.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
|
|
23330
23740
|
exports.eighthPointMeasureValue = eighthPointMeasureValue;
|
|
23331
|
-
exports.encodeUtf8 = encodeUtf8;
|
|
23332
23741
|
exports.hashedId = hashedId;
|
|
23333
23742
|
exports.hexColorValue = hexColorValue;
|
|
23334
23743
|
exports.hpsMeasureValue = hpsMeasureValue;
|