@sunertech/docx 10.0.7 → 10.1.8
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/README.md +4 -0
- package/dist/index.cjs +38 -0
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.iife.js +38 -0
- package/dist/index.mjs +38 -0
- package/dist/index.umd.cjs +38 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
+
<p align="center">
|
|
10
|
+
This fork supports Chart
|
|
11
|
+
</p>
|
|
9
12
|
---
|
|
10
13
|
|
|
11
14
|
[![NPM version][npm-image]][npm-url]
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
<img src="https://i.imgur.com/QeL1HuU.png" alt="drawing"/>
|
|
21
24
|
</p>
|
|
22
25
|
|
|
26
|
+
|
|
23
27
|
# Demo
|
|
24
28
|
|
|
25
29
|
## Browser
|
package/dist/index.cjs
CHANGED
|
@@ -18366,6 +18366,9 @@ class Border extends IgnoreIfEmptyXmlComponent {
|
|
|
18366
18366
|
if (options.right) {
|
|
18367
18367
|
this.root.push(new BorderElement("w:right", options.right));
|
|
18368
18368
|
}
|
|
18369
|
+
if (options.between) {
|
|
18370
|
+
this.root.push(new BorderElement("w:between", options.between));
|
|
18371
|
+
}
|
|
18369
18372
|
}
|
|
18370
18373
|
}
|
|
18371
18374
|
class ThematicBreak extends XmlComponent {
|
|
@@ -21864,6 +21867,40 @@ var NumberedItemReferenceFormat = /* @__PURE__ */ ((NumberedItemReferenceFormat2
|
|
|
21864
21867
|
NumberedItemReferenceFormat2["FULL_CONTEXT"] = "full_context";
|
|
21865
21868
|
return NumberedItemReferenceFormat2;
|
|
21866
21869
|
})(NumberedItemReferenceFormat || {});
|
|
21870
|
+
const SWITCH_MAP = {
|
|
21871
|
+
[
|
|
21872
|
+
"relative"
|
|
21873
|
+
/* RELATIVE */
|
|
21874
|
+
]: "\\r",
|
|
21875
|
+
[
|
|
21876
|
+
"no_context"
|
|
21877
|
+
/* NO_CONTEXT */
|
|
21878
|
+
]: "\\n",
|
|
21879
|
+
[
|
|
21880
|
+
"full_context"
|
|
21881
|
+
/* FULL_CONTEXT */
|
|
21882
|
+
]: "\\w",
|
|
21883
|
+
[
|
|
21884
|
+
"none"
|
|
21885
|
+
/* NONE */
|
|
21886
|
+
]: void 0
|
|
21887
|
+
};
|
|
21888
|
+
class NumberedItemReference extends SimpleField {
|
|
21889
|
+
constructor(bookmarkId, cachedValue, options = {}) {
|
|
21890
|
+
const {
|
|
21891
|
+
hyperlink = true,
|
|
21892
|
+
referenceFormat = "full_context"
|
|
21893
|
+
/* FULL_CONTEXT */
|
|
21894
|
+
} = options;
|
|
21895
|
+
const baseInstruction = `REF ${bookmarkId}`;
|
|
21896
|
+
const switches = [
|
|
21897
|
+
...hyperlink ? ["\\h"] : [],
|
|
21898
|
+
...[SWITCH_MAP[referenceFormat]].filter((a) => !!a)
|
|
21899
|
+
];
|
|
21900
|
+
const instruction = `${baseInstruction} ${switches.join(" ")}`;
|
|
21901
|
+
super(instruction, cachedValue);
|
|
21902
|
+
}
|
|
21903
|
+
}
|
|
21867
21904
|
class OutlineLevel extends XmlComponent {
|
|
21868
21905
|
constructor(level) {
|
|
21869
21906
|
super("w:outlineLvl");
|
|
@@ -30084,6 +30121,7 @@ exports.NoBreakHyphen = NoBreakHyphen;
|
|
|
30084
30121
|
exports.NumberFormat = NumberFormat$1;
|
|
30085
30122
|
exports.NumberProperties = NumberProperties;
|
|
30086
30123
|
exports.NumberValueElement = NumberValueElement;
|
|
30124
|
+
exports.NumberedItemReference = NumberedItemReference;
|
|
30087
30125
|
exports.NumberedItemReferenceFormat = NumberedItemReferenceFormat;
|
|
30088
30126
|
exports.Numbering = Numbering;
|
|
30089
30127
|
exports.OnOffElement = OnOffElement;
|
package/dist/index.d.cts
CHANGED
|
@@ -1155,6 +1155,7 @@ export declare type IBordersOptions = {
|
|
|
1155
1155
|
readonly bottom?: IBorderOptions;
|
|
1156
1156
|
readonly left?: IBorderOptions;
|
|
1157
1157
|
readonly right?: IBorderOptions;
|
|
1158
|
+
readonly between?: IBorderOptions;
|
|
1158
1159
|
};
|
|
1159
1160
|
|
|
1160
1161
|
declare type IChangedAttributesProperties = {
|
|
@@ -1606,6 +1607,11 @@ export declare class InternalHyperlink extends ConcreteHyperlink {
|
|
|
1606
1607
|
});
|
|
1607
1608
|
}
|
|
1608
1609
|
|
|
1610
|
+
export declare type INumberedItemReferenceOptions = {
|
|
1611
|
+
readonly hyperlink?: boolean;
|
|
1612
|
+
readonly referenceFormat?: NumberedItemReferenceFormat;
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1609
1615
|
export declare type INumberingOptions = {
|
|
1610
1616
|
readonly config: readonly {
|
|
1611
1617
|
readonly levels: readonly ILevelsOptions[];
|
|
@@ -1661,7 +1667,7 @@ export declare type IPageSizeAttributes = {
|
|
|
1661
1667
|
};
|
|
1662
1668
|
|
|
1663
1669
|
export declare type IParagraphOptions = {
|
|
1664
|
-
readonly text?: string;
|
|
1670
|
+
readonly text?: string | IRunOptions;
|
|
1665
1671
|
readonly children?: readonly ParagraphChild[];
|
|
1666
1672
|
} & IParagraphPropertiesOptions;
|
|
1667
1673
|
|
|
@@ -2478,6 +2484,10 @@ export declare class NoBreakHyphen extends EmptyElement {
|
|
|
2478
2484
|
constructor();
|
|
2479
2485
|
}
|
|
2480
2486
|
|
|
2487
|
+
export declare class NumberedItemReference extends SimpleField {
|
|
2488
|
+
constructor(bookmarkId: string, cachedValue?: string, options?: INumberedItemReferenceOptions);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2481
2491
|
export declare enum NumberedItemReferenceFormat {
|
|
2482
2492
|
NONE = "none",
|
|
2483
2493
|
RELATIVE = "relative",
|
package/dist/index.d.ts
CHANGED
|
@@ -1155,6 +1155,7 @@ export declare type IBordersOptions = {
|
|
|
1155
1155
|
readonly bottom?: IBorderOptions;
|
|
1156
1156
|
readonly left?: IBorderOptions;
|
|
1157
1157
|
readonly right?: IBorderOptions;
|
|
1158
|
+
readonly between?: IBorderOptions;
|
|
1158
1159
|
};
|
|
1159
1160
|
|
|
1160
1161
|
declare type IChangedAttributesProperties = {
|
|
@@ -1606,6 +1607,11 @@ export declare class InternalHyperlink extends ConcreteHyperlink {
|
|
|
1606
1607
|
});
|
|
1607
1608
|
}
|
|
1608
1609
|
|
|
1610
|
+
export declare type INumberedItemReferenceOptions = {
|
|
1611
|
+
readonly hyperlink?: boolean;
|
|
1612
|
+
readonly referenceFormat?: NumberedItemReferenceFormat;
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1609
1615
|
export declare type INumberingOptions = {
|
|
1610
1616
|
readonly config: readonly {
|
|
1611
1617
|
readonly levels: readonly ILevelsOptions[];
|
|
@@ -1661,7 +1667,7 @@ export declare type IPageSizeAttributes = {
|
|
|
1661
1667
|
};
|
|
1662
1668
|
|
|
1663
1669
|
export declare type IParagraphOptions = {
|
|
1664
|
-
readonly text?: string;
|
|
1670
|
+
readonly text?: string | IRunOptions;
|
|
1665
1671
|
readonly children?: readonly ParagraphChild[];
|
|
1666
1672
|
} & IParagraphPropertiesOptions;
|
|
1667
1673
|
|
|
@@ -2478,6 +2484,10 @@ export declare class NoBreakHyphen extends EmptyElement {
|
|
|
2478
2484
|
constructor();
|
|
2479
2485
|
}
|
|
2480
2486
|
|
|
2487
|
+
export declare class NumberedItemReference extends SimpleField {
|
|
2488
|
+
constructor(bookmarkId: string, cachedValue?: string, options?: INumberedItemReferenceOptions);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2481
2491
|
export declare enum NumberedItemReferenceFormat {
|
|
2482
2492
|
NONE = "none",
|
|
2483
2493
|
RELATIVE = "relative",
|
package/dist/index.iife.js
CHANGED
|
@@ -18366,6 +18366,9 @@ var docx = (function(exports) {
|
|
|
18366
18366
|
if (options.right) {
|
|
18367
18367
|
this.root.push(new BorderElement("w:right", options.right));
|
|
18368
18368
|
}
|
|
18369
|
+
if (options.between) {
|
|
18370
|
+
this.root.push(new BorderElement("w:between", options.between));
|
|
18371
|
+
}
|
|
18369
18372
|
}
|
|
18370
18373
|
}
|
|
18371
18374
|
class ThematicBreak extends XmlComponent {
|
|
@@ -21864,6 +21867,40 @@ var docx = (function(exports) {
|
|
|
21864
21867
|
NumberedItemReferenceFormat2["FULL_CONTEXT"] = "full_context";
|
|
21865
21868
|
return NumberedItemReferenceFormat2;
|
|
21866
21869
|
})(NumberedItemReferenceFormat || {});
|
|
21870
|
+
const SWITCH_MAP = {
|
|
21871
|
+
[
|
|
21872
|
+
"relative"
|
|
21873
|
+
/* RELATIVE */
|
|
21874
|
+
]: "\\r",
|
|
21875
|
+
[
|
|
21876
|
+
"no_context"
|
|
21877
|
+
/* NO_CONTEXT */
|
|
21878
|
+
]: "\\n",
|
|
21879
|
+
[
|
|
21880
|
+
"full_context"
|
|
21881
|
+
/* FULL_CONTEXT */
|
|
21882
|
+
]: "\\w",
|
|
21883
|
+
[
|
|
21884
|
+
"none"
|
|
21885
|
+
/* NONE */
|
|
21886
|
+
]: void 0
|
|
21887
|
+
};
|
|
21888
|
+
class NumberedItemReference extends SimpleField {
|
|
21889
|
+
constructor(bookmarkId, cachedValue, options = {}) {
|
|
21890
|
+
const {
|
|
21891
|
+
hyperlink = true,
|
|
21892
|
+
referenceFormat = "full_context"
|
|
21893
|
+
/* FULL_CONTEXT */
|
|
21894
|
+
} = options;
|
|
21895
|
+
const baseInstruction = `REF ${bookmarkId}`;
|
|
21896
|
+
const switches = [
|
|
21897
|
+
...hyperlink ? ["\\h"] : [],
|
|
21898
|
+
...[SWITCH_MAP[referenceFormat]].filter((a) => !!a)
|
|
21899
|
+
];
|
|
21900
|
+
const instruction = `${baseInstruction} ${switches.join(" ")}`;
|
|
21901
|
+
super(instruction, cachedValue);
|
|
21902
|
+
}
|
|
21903
|
+
}
|
|
21867
21904
|
class OutlineLevel extends XmlComponent {
|
|
21868
21905
|
constructor(level) {
|
|
21869
21906
|
super("w:outlineLvl");
|
|
@@ -30084,6 +30121,7 @@ var docx = (function(exports) {
|
|
|
30084
30121
|
exports.NumberFormat = NumberFormat$1;
|
|
30085
30122
|
exports.NumberProperties = NumberProperties;
|
|
30086
30123
|
exports.NumberValueElement = NumberValueElement;
|
|
30124
|
+
exports.NumberedItemReference = NumberedItemReference;
|
|
30087
30125
|
exports.NumberedItemReferenceFormat = NumberedItemReferenceFormat;
|
|
30088
30126
|
exports.Numbering = Numbering;
|
|
30089
30127
|
exports.OnOffElement = OnOffElement;
|
package/dist/index.mjs
CHANGED
|
@@ -18364,6 +18364,9 @@ class Border extends IgnoreIfEmptyXmlComponent {
|
|
|
18364
18364
|
if (options.right) {
|
|
18365
18365
|
this.root.push(new BorderElement("w:right", options.right));
|
|
18366
18366
|
}
|
|
18367
|
+
if (options.between) {
|
|
18368
|
+
this.root.push(new BorderElement("w:between", options.between));
|
|
18369
|
+
}
|
|
18367
18370
|
}
|
|
18368
18371
|
}
|
|
18369
18372
|
class ThematicBreak extends XmlComponent {
|
|
@@ -21862,6 +21865,40 @@ var NumberedItemReferenceFormat = /* @__PURE__ */ ((NumberedItemReferenceFormat2
|
|
|
21862
21865
|
NumberedItemReferenceFormat2["FULL_CONTEXT"] = "full_context";
|
|
21863
21866
|
return NumberedItemReferenceFormat2;
|
|
21864
21867
|
})(NumberedItemReferenceFormat || {});
|
|
21868
|
+
const SWITCH_MAP = {
|
|
21869
|
+
[
|
|
21870
|
+
"relative"
|
|
21871
|
+
/* RELATIVE */
|
|
21872
|
+
]: "\\r",
|
|
21873
|
+
[
|
|
21874
|
+
"no_context"
|
|
21875
|
+
/* NO_CONTEXT */
|
|
21876
|
+
]: "\\n",
|
|
21877
|
+
[
|
|
21878
|
+
"full_context"
|
|
21879
|
+
/* FULL_CONTEXT */
|
|
21880
|
+
]: "\\w",
|
|
21881
|
+
[
|
|
21882
|
+
"none"
|
|
21883
|
+
/* NONE */
|
|
21884
|
+
]: void 0
|
|
21885
|
+
};
|
|
21886
|
+
class NumberedItemReference extends SimpleField {
|
|
21887
|
+
constructor(bookmarkId, cachedValue, options = {}) {
|
|
21888
|
+
const {
|
|
21889
|
+
hyperlink = true,
|
|
21890
|
+
referenceFormat = "full_context"
|
|
21891
|
+
/* FULL_CONTEXT */
|
|
21892
|
+
} = options;
|
|
21893
|
+
const baseInstruction = `REF ${bookmarkId}`;
|
|
21894
|
+
const switches = [
|
|
21895
|
+
...hyperlink ? ["\\h"] : [],
|
|
21896
|
+
...[SWITCH_MAP[referenceFormat]].filter((a) => !!a)
|
|
21897
|
+
];
|
|
21898
|
+
const instruction = `${baseInstruction} ${switches.join(" ")}`;
|
|
21899
|
+
super(instruction, cachedValue);
|
|
21900
|
+
}
|
|
21901
|
+
}
|
|
21865
21902
|
class OutlineLevel extends XmlComponent {
|
|
21866
21903
|
constructor(level) {
|
|
21867
21904
|
super("w:outlineLvl");
|
|
@@ -30083,6 +30120,7 @@ export {
|
|
|
30083
30120
|
NumberFormat$1 as NumberFormat,
|
|
30084
30121
|
NumberProperties,
|
|
30085
30122
|
NumberValueElement,
|
|
30123
|
+
NumberedItemReference,
|
|
30086
30124
|
NumberedItemReferenceFormat,
|
|
30087
30125
|
Numbering,
|
|
30088
30126
|
OnOffElement,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -18368,6 +18368,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18368
18368
|
if (options.right) {
|
|
18369
18369
|
this.root.push(new BorderElement("w:right", options.right));
|
|
18370
18370
|
}
|
|
18371
|
+
if (options.between) {
|
|
18372
|
+
this.root.push(new BorderElement("w:between", options.between));
|
|
18373
|
+
}
|
|
18371
18374
|
}
|
|
18372
18375
|
}
|
|
18373
18376
|
class ThematicBreak extends XmlComponent {
|
|
@@ -21866,6 +21869,40 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21866
21869
|
NumberedItemReferenceFormat2["FULL_CONTEXT"] = "full_context";
|
|
21867
21870
|
return NumberedItemReferenceFormat2;
|
|
21868
21871
|
})(NumberedItemReferenceFormat || {});
|
|
21872
|
+
const SWITCH_MAP = {
|
|
21873
|
+
[
|
|
21874
|
+
"relative"
|
|
21875
|
+
/* RELATIVE */
|
|
21876
|
+
]: "\\r",
|
|
21877
|
+
[
|
|
21878
|
+
"no_context"
|
|
21879
|
+
/* NO_CONTEXT */
|
|
21880
|
+
]: "\\n",
|
|
21881
|
+
[
|
|
21882
|
+
"full_context"
|
|
21883
|
+
/* FULL_CONTEXT */
|
|
21884
|
+
]: "\\w",
|
|
21885
|
+
[
|
|
21886
|
+
"none"
|
|
21887
|
+
/* NONE */
|
|
21888
|
+
]: void 0
|
|
21889
|
+
};
|
|
21890
|
+
class NumberedItemReference extends SimpleField {
|
|
21891
|
+
constructor(bookmarkId, cachedValue, options = {}) {
|
|
21892
|
+
const {
|
|
21893
|
+
hyperlink = true,
|
|
21894
|
+
referenceFormat = "full_context"
|
|
21895
|
+
/* FULL_CONTEXT */
|
|
21896
|
+
} = options;
|
|
21897
|
+
const baseInstruction = `REF ${bookmarkId}`;
|
|
21898
|
+
const switches = [
|
|
21899
|
+
...hyperlink ? ["\\h"] : [],
|
|
21900
|
+
...[SWITCH_MAP[referenceFormat]].filter((a) => !!a)
|
|
21901
|
+
];
|
|
21902
|
+
const instruction = `${baseInstruction} ${switches.join(" ")}`;
|
|
21903
|
+
super(instruction, cachedValue);
|
|
21904
|
+
}
|
|
21905
|
+
}
|
|
21869
21906
|
class OutlineLevel extends XmlComponent {
|
|
21870
21907
|
constructor(level) {
|
|
21871
21908
|
super("w:outlineLvl");
|
|
@@ -30086,6 +30123,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
30086
30123
|
exports2.NumberFormat = NumberFormat$1;
|
|
30087
30124
|
exports2.NumberProperties = NumberProperties;
|
|
30088
30125
|
exports2.NumberValueElement = NumberValueElement;
|
|
30126
|
+
exports2.NumberedItemReference = NumberedItemReference;
|
|
30089
30127
|
exports2.NumberedItemReferenceFormat = NumberedItemReferenceFormat;
|
|
30090
30128
|
exports2.Numbering = Numbering;
|
|
30091
30129
|
exports2.OnOffElement = OnOffElement;
|
package/package.json
CHANGED