docx-wasm 0.4.18-rc2 → 0.4.18-rc21
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/node/builder.js +6 -6
- package/dist/node/builder.js.map +1 -1
- package/dist/node/doc-defaults.d.ts +1 -1
- package/dist/node/doc-defaults.js +15 -4
- package/dist/node/doc-defaults.js.map +1 -1
- package/dist/node/footer.d.ts +1 -5
- package/dist/node/footer.js +0 -8
- package/dist/node/footer.js.map +1 -1
- package/dist/node/header.d.ts +1 -5
- package/dist/node/header.js +0 -8
- package/dist/node/header.js.map +1 -1
- package/dist/node/index.d.ts +7 -2
- package/dist/node/index.js +27 -19
- package/dist/node/index.js.map +1 -1
- package/dist/node/json/bindings/PositionalTab.d.ts +8 -0
- package/dist/node/json/bindings/PositionalTab.js +3 -0
- package/dist/node/json/bindings/PositionalTab.js.map +1 -0
- package/dist/node/json/bindings/PositionalTabAlignmentType.d.ts +1 -0
- package/dist/node/json/bindings/PositionalTabAlignmentType.js +3 -0
- package/dist/node/json/bindings/PositionalTabAlignmentType.js.map +1 -0
- package/dist/node/json/bindings/PositionalTabRelativeTo.d.ts +1 -0
- package/dist/node/json/bindings/PositionalTabRelativeTo.js +3 -0
- package/dist/node/json/bindings/PositionalTabRelativeTo.js.map +1 -0
- package/dist/node/json/paragraph.d.ts +1 -0
- package/dist/node/json/run.d.ts +13 -2
- package/dist/node/level.d.ts +1 -1
- package/dist/node/level.js +11 -10
- package/dist/node/level.js.map +1 -1
- package/dist/node/paragraph-property.d.ts +21 -7
- package/dist/node/paragraph-property.js +258 -31
- package/dist/node/paragraph-property.js.map +1 -1
- package/dist/node/paragraph.d.ts +4 -1
- package/dist/node/paragraph.js +24 -16
- package/dist/node/paragraph.js.map +1 -1
- package/dist/node/pkg/docx_wasm.d.ts +609 -262
- package/dist/node/pkg/docx_wasm.js +1070 -333
- package/dist/node/pkg/docx_wasm_bg.wasm +0 -0
- package/dist/node/pkg/docx_wasm_bg.wasm.d.ts +187 -121
- package/dist/node/positional-tab.d.ts +12 -0
- package/dist/node/positional-tab.js +44 -0
- package/dist/node/positional-tab.js.map +1 -0
- package/dist/node/run-property.d.ts +74 -0
- package/dist/node/run-property.js +303 -0
- package/dist/node/run-property.js.map +1 -0
- package/dist/node/run.d.ts +4 -57
- package/dist/node/run.js +58 -177
- package/dist/node/run.js.map +1 -1
- package/dist/node/style.d.ts +3 -1
- package/dist/node/style.js +42 -42
- package/dist/node/style.js.map +1 -1
- package/dist/node/styles.d.ts +1 -1
- package/dist/node/tab-leader.d.ts +3 -0
- package/dist/node/tab-leader.js +48 -0
- package/dist/node/tab-leader.js.map +1 -0
- package/dist/node/table-cell.js +9 -9
- package/dist/node/table-cell.js.map +1 -1
- package/dist/node/table-of-contents.d.ts +3 -0
- package/dist/node/table-of-contents.js +9 -0
- package/dist/node/table-of-contents.js.map +1 -1
- package/dist/web/builder.js +6 -6
- package/dist/web/builder.js.map +1 -1
- package/dist/web/doc-defaults.d.ts +1 -1
- package/dist/web/doc-defaults.js +15 -4
- package/dist/web/doc-defaults.js.map +1 -1
- package/dist/web/footer.d.ts +1 -5
- package/dist/web/footer.js +0 -8
- package/dist/web/footer.js.map +1 -1
- package/dist/web/header.d.ts +1 -5
- package/dist/web/header.js +0 -8
- package/dist/web/header.js.map +1 -1
- package/dist/web/index.d.ts +7 -2
- package/dist/web/index.js +27 -19
- package/dist/web/index.js.map +1 -1
- package/dist/web/json/bindings/PositionalTab.d.ts +8 -0
- package/dist/web/json/bindings/PositionalTab.js +2 -0
- package/dist/web/json/bindings/PositionalTab.js.map +1 -0
- package/dist/web/json/bindings/PositionalTabAlignmentType.d.ts +1 -0
- package/dist/web/json/bindings/PositionalTabAlignmentType.js +2 -0
- package/dist/web/json/bindings/PositionalTabAlignmentType.js.map +1 -0
- package/dist/web/json/bindings/PositionalTabRelativeTo.d.ts +1 -0
- package/dist/web/json/bindings/PositionalTabRelativeTo.js +2 -0
- package/dist/web/json/bindings/PositionalTabRelativeTo.js.map +1 -0
- package/dist/web/json/paragraph.d.ts +1 -0
- package/dist/web/json/run.d.ts +13 -2
- package/dist/web/level.d.ts +1 -1
- package/dist/web/level.js +11 -10
- package/dist/web/level.js.map +1 -1
- package/dist/web/paragraph-property.d.ts +21 -7
- package/dist/web/paragraph-property.js +255 -30
- package/dist/web/paragraph-property.js.map +1 -1
- package/dist/web/paragraph.d.ts +4 -1
- package/dist/web/paragraph.js +24 -16
- package/dist/web/paragraph.js.map +1 -1
- package/dist/web/pkg/docx_wasm.d.ts +609 -262
- package/dist/web/pkg/docx_wasm_bg.js +1063 -330
- package/dist/web/pkg/docx_wasm_bg.wasm +0 -0
- package/dist/web/pkg/docx_wasm_bg.wasm.d.ts +187 -121
- package/dist/web/positional-tab.d.ts +12 -0
- package/dist/web/positional-tab.js +40 -0
- package/dist/web/positional-tab.js.map +1 -0
- package/dist/web/run-property.d.ts +74 -0
- package/dist/web/run-property.js +271 -0
- package/dist/web/run-property.js.map +1 -0
- package/dist/web/run.d.ts +4 -57
- package/dist/web/run.js +57 -172
- package/dist/web/run.js.map +1 -1
- package/dist/web/style.d.ts +3 -1
- package/dist/web/style.js +42 -42
- package/dist/web/style.js.map +1 -1
- package/dist/web/styles.d.ts +1 -1
- package/dist/web/tab-leader.d.ts +3 -0
- package/dist/web/tab-leader.js +21 -0
- package/dist/web/tab-leader.js.map +1 -0
- package/dist/web/table-cell.js +1 -1
- package/dist/web/table-cell.js.map +1 -1
- package/dist/web/table-of-contents.d.ts +3 -0
- package/dist/web/table-of-contents.js +9 -0
- package/dist/web/table-of-contents.js.map +1 -1
- package/js/builder.ts +8 -8
- package/js/doc-defaults.ts +13 -6
- package/js/footer.ts +1 -13
- package/js/header.ts +1 -13
- package/js/index.ts +30 -21
- package/js/json/bindings/PositionalTab.ts +5 -0
- package/js/json/bindings/PositionalTabAlignmentType.ts +2 -0
- package/js/json/bindings/PositionalTabRelativeTo.ts +2 -0
- package/js/json/paragraph.ts +1 -0
- package/js/json/run.ts +14 -1
- package/js/level.ts +15 -11
- package/js/paragraph-property.ts +299 -37
- package/js/paragraph.ts +28 -17
- package/js/positional-tab.ts +50 -0
- package/js/run-property.ts +383 -0
- package/js/run.ts +50 -256
- package/js/style.ts +45 -49
- package/js/styles.ts +1 -1
- package/js/tab-leader.ts +22 -0
- package/js/table-cell.ts +1 -1
- package/js/table-of-contents.ts +16 -0
- package/package.json +11 -8
package/js/paragraph.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Run
|
|
1
|
+
import { Run } from "./run";
|
|
2
|
+
import { RunFonts } from "./run-property";
|
|
2
3
|
import {
|
|
3
4
|
createDefaultParagraphProperty,
|
|
4
5
|
ParagraphProperty,
|
|
@@ -94,22 +95,22 @@ export class Paragraph {
|
|
|
94
95
|
pos: number | null;
|
|
95
96
|
}[]
|
|
96
97
|
) {
|
|
97
|
-
this.property.
|
|
98
|
+
this.property._tabs = tabs;
|
|
98
99
|
return this;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
align(type: AlignmentType) {
|
|
102
|
-
this.property.
|
|
103
|
+
this.property._align = type;
|
|
103
104
|
return this;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
textAlignment(type: TextAlignmentType) {
|
|
107
|
-
this.property.
|
|
108
|
+
this.property._textAlignment = type;
|
|
108
109
|
return this;
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
adjustRightInd(v: number) {
|
|
112
|
-
this.property.
|
|
113
|
+
this.property._adjustRightInd = v;
|
|
113
114
|
return this;
|
|
114
115
|
}
|
|
115
116
|
|
|
@@ -145,63 +146,73 @@ export class Paragraph {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
characterSpacing(spacing: number) {
|
|
148
|
-
this.property.runProperty.
|
|
149
|
+
this.property.runProperty.spacing(spacing);
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
snapToGrid(v: boolean) {
|
|
154
|
+
this.property.snapToGrid = v;
|
|
149
155
|
return this;
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
keepNext(v: boolean) {
|
|
153
|
-
this.property =
|
|
159
|
+
this.property.keepNext = v;
|
|
154
160
|
return this;
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
keepLines(v: boolean) {
|
|
158
|
-
this.property =
|
|
164
|
+
this.property.keepLines = v;
|
|
159
165
|
return this;
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
pageBreakBefore(v: boolean) {
|
|
163
|
-
this.property =
|
|
169
|
+
this.property.pageBreakBefore = v;
|
|
164
170
|
return this;
|
|
165
171
|
}
|
|
166
172
|
|
|
167
173
|
widowControl(v: boolean) {
|
|
168
|
-
this.property =
|
|
174
|
+
this.property.widowControl = v;
|
|
169
175
|
return this;
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
// run property
|
|
173
179
|
size(size: number) {
|
|
174
|
-
this.property.runProperty
|
|
180
|
+
this.property.runProperty.size(size);
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
color(color: string) {
|
|
185
|
+
this.property.runProperty.color(color);
|
|
175
186
|
return this;
|
|
176
187
|
}
|
|
177
188
|
|
|
178
189
|
bold() {
|
|
179
|
-
this.property.runProperty
|
|
190
|
+
this.property.runProperty.bold();
|
|
180
191
|
return this;
|
|
181
192
|
}
|
|
182
193
|
|
|
183
194
|
italic() {
|
|
184
|
-
this.property.runProperty
|
|
195
|
+
this.property.runProperty.italic();
|
|
185
196
|
return this;
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
fonts(fonts: RunFonts) {
|
|
189
|
-
this.property.runProperty
|
|
200
|
+
this.property.runProperty.fonts(fonts);
|
|
190
201
|
return this;
|
|
191
202
|
}
|
|
192
203
|
|
|
193
204
|
delete(author: string, date: string) {
|
|
194
|
-
this.property.runProperty.
|
|
205
|
+
this.property.runProperty.delete(author, date);
|
|
195
206
|
return this;
|
|
196
207
|
}
|
|
197
208
|
|
|
198
209
|
insert(author: string, date: string) {
|
|
199
|
-
this.property.runProperty.
|
|
210
|
+
this.property.runProperty.insert(author, date);
|
|
200
211
|
return this;
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
outlineLevel(v: number) {
|
|
204
|
-
this.property =
|
|
215
|
+
this.property.outlineLvl = v;
|
|
205
216
|
return this;
|
|
206
217
|
}
|
|
207
218
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PositionalTabAlignmentType } from "./json/bindings/PositionalTabAlignmentType";
|
|
2
|
+
import { PositionalTabRelativeTo } from "./json/bindings/PositionalTabRelativeTo";
|
|
3
|
+
import { TabLeaderType } from "./json/bindings/TabLeaderType";
|
|
4
|
+
import {
|
|
5
|
+
createPositionalTab,
|
|
6
|
+
PositionalTabAlignmentType as _PositionalTabAlignmentType,
|
|
7
|
+
PositionalTabRelativeTo as _PositionalTabRelativeTo,
|
|
8
|
+
TabLeaderType as _TabLeaderType,
|
|
9
|
+
} from "./pkg/docx_wasm";
|
|
10
|
+
import { convertTabLeader } from "./tab-leader";
|
|
11
|
+
|
|
12
|
+
export class PositionalTab {
|
|
13
|
+
_alignment: PositionalTabAlignmentType = "left";
|
|
14
|
+
_relativeTo: PositionalTabRelativeTo = "margin";
|
|
15
|
+
_leader: TabLeaderType = "none";
|
|
16
|
+
|
|
17
|
+
alignment(t: PositionalTabAlignmentType) {
|
|
18
|
+
this._alignment = t;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
relativeTo(t: PositionalTabRelativeTo) {
|
|
23
|
+
this._relativeTo = t;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
leader(l: TabLeaderType) {
|
|
28
|
+
this._leader = l;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
buildWasmObject() {
|
|
33
|
+
const alignment = (() => {
|
|
34
|
+
if (this._alignment === "left") return _PositionalTabAlignmentType.Left;
|
|
35
|
+
if (this._alignment === "center")
|
|
36
|
+
return _PositionalTabAlignmentType.Center;
|
|
37
|
+
if (this._alignment === "right") return _PositionalTabAlignmentType.Right;
|
|
38
|
+
return _PositionalTabAlignmentType.Left;
|
|
39
|
+
})();
|
|
40
|
+
|
|
41
|
+
const relativeTo = (() => {
|
|
42
|
+
if (this._relativeTo === "indent") return _PositionalTabRelativeTo.Indent;
|
|
43
|
+
return _PositionalTabRelativeTo.Margin;
|
|
44
|
+
})();
|
|
45
|
+
|
|
46
|
+
const leader = convertTabLeader(this._leader);
|
|
47
|
+
|
|
48
|
+
return createPositionalTab(alignment, relativeTo, leader);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import * as wasm from "./pkg/docx_wasm";
|
|
2
|
+
|
|
3
|
+
import { BorderType } from "./border";
|
|
4
|
+
|
|
5
|
+
export type TextBorder = {
|
|
6
|
+
borderType: BorderType;
|
|
7
|
+
color: string;
|
|
8
|
+
space: number;
|
|
9
|
+
size: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type VertAlignType = "baseline" | "superscript" | "subscript";
|
|
13
|
+
|
|
14
|
+
export type RunPropertyDel = {
|
|
15
|
+
author: string;
|
|
16
|
+
date: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type RunPropertyIns = {
|
|
20
|
+
author: string;
|
|
21
|
+
date: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export class RunProperty {
|
|
25
|
+
_style?: string;
|
|
26
|
+
_size?: number;
|
|
27
|
+
_color?: string;
|
|
28
|
+
_highlight?: string;
|
|
29
|
+
_vertAlign?: VertAlignType;
|
|
30
|
+
_bold?: boolean;
|
|
31
|
+
_italic?: boolean;
|
|
32
|
+
_strike?: boolean;
|
|
33
|
+
_underline?: string;
|
|
34
|
+
_vanish?: boolean;
|
|
35
|
+
_fonts?: RunFonts;
|
|
36
|
+
_characterSpacing?: number;
|
|
37
|
+
_textBorder?: TextBorder;
|
|
38
|
+
_ins?: RunPropertyIns;
|
|
39
|
+
_del?: RunPropertyDel;
|
|
40
|
+
|
|
41
|
+
style(style: string) {
|
|
42
|
+
this._style = style;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
size(size: number) {
|
|
47
|
+
this._size = size;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
color(color: string) {
|
|
52
|
+
this._color = color;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
highlight(color: string) {
|
|
57
|
+
this._highlight = color;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
vertAlign(vertAlign: VertAlignType) {
|
|
62
|
+
this._vertAlign = vertAlign;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
bold() {
|
|
67
|
+
this._bold = true;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
strike() {
|
|
72
|
+
this._strike = true;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
italic() {
|
|
77
|
+
this._italic = true;
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
underline(type: string) {
|
|
82
|
+
this._underline = type;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
vanish() {
|
|
87
|
+
this._vanish = true;
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
fonts(fonts: RunFonts) {
|
|
92
|
+
this._fonts = fonts;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
spacing(characterSpacing: number) {
|
|
97
|
+
this._characterSpacing = characterSpacing;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
delete(author: string, date: string) {
|
|
102
|
+
this._del = { author, date };
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
insert(author: string, date: string) {
|
|
107
|
+
this._ins = { author, date };
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
textBorder(type: BorderType, size: number, space: number, color: string) {
|
|
112
|
+
this._textBorder = {
|
|
113
|
+
borderType: type,
|
|
114
|
+
size,
|
|
115
|
+
space,
|
|
116
|
+
color,
|
|
117
|
+
};
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const convertBorderType = (t: BorderType) => {
|
|
123
|
+
switch (t) {
|
|
124
|
+
case "nil":
|
|
125
|
+
return wasm.BorderType.Nil;
|
|
126
|
+
case "none":
|
|
127
|
+
return wasm.BorderType.None;
|
|
128
|
+
case "single":
|
|
129
|
+
return wasm.BorderType.Single;
|
|
130
|
+
case "thick":
|
|
131
|
+
return wasm.BorderType.Thick;
|
|
132
|
+
case "double":
|
|
133
|
+
return wasm.BorderType.Double;
|
|
134
|
+
case "dotted":
|
|
135
|
+
return wasm.BorderType.Dotted;
|
|
136
|
+
case "dashed":
|
|
137
|
+
return wasm.BorderType.Dashed;
|
|
138
|
+
case "dotDash":
|
|
139
|
+
return wasm.BorderType.DotDash;
|
|
140
|
+
case "dotDotDash":
|
|
141
|
+
return wasm.BorderType.DotDotDash;
|
|
142
|
+
case "triple":
|
|
143
|
+
return wasm.BorderType.Triple;
|
|
144
|
+
default:
|
|
145
|
+
return wasm.BorderType.Single;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const createDefaultRunProperty = (): RunProperty => {
|
|
150
|
+
return new RunProperty();
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export class RunFonts {
|
|
154
|
+
_ascii?: string;
|
|
155
|
+
_hiAnsi?: string;
|
|
156
|
+
_eastAsia?: string;
|
|
157
|
+
_cs?: string;
|
|
158
|
+
_asciiTheme?: string;
|
|
159
|
+
_hiAnsiTheme?: string;
|
|
160
|
+
_eastAsiaTheme?: string;
|
|
161
|
+
_csTheme?: string;
|
|
162
|
+
_hint?: string;
|
|
163
|
+
|
|
164
|
+
ascii(f: string) {
|
|
165
|
+
this._ascii = f;
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
hiAnsi(f: string) {
|
|
170
|
+
this._hiAnsi = f;
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
cs(f: string) {
|
|
175
|
+
this._cs = f;
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
eastAsia(f: string) {
|
|
180
|
+
this._eastAsia = f;
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
asciiTheme(f: string) {
|
|
185
|
+
this._asciiTheme = f;
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
hiAnsiTheme(f: string) {
|
|
190
|
+
this._hiAnsiTheme = f;
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
csTheme(f: string) {
|
|
195
|
+
this._csTheme = f;
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
eastAsiaTheme(f: string) {
|
|
200
|
+
this._eastAsia = f;
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
hint(f: string) {
|
|
205
|
+
this._hint = f;
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
buildWasmObject = () => {
|
|
210
|
+
let f = wasm.createRunFonts();
|
|
211
|
+
if (this?._ascii) {
|
|
212
|
+
f = f.ascii(this._ascii);
|
|
213
|
+
}
|
|
214
|
+
if (this?._hiAnsi) {
|
|
215
|
+
f = f.hi_ansi(this._hiAnsi);
|
|
216
|
+
}
|
|
217
|
+
if (this?._cs) {
|
|
218
|
+
f = f.cs(this._cs);
|
|
219
|
+
}
|
|
220
|
+
if (this?._eastAsia) {
|
|
221
|
+
f = f.east_asia(this._eastAsia);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// theme
|
|
225
|
+
if (this?._asciiTheme) {
|
|
226
|
+
f = f.ascii_theme(this._asciiTheme);
|
|
227
|
+
}
|
|
228
|
+
if (this?._hiAnsiTheme) {
|
|
229
|
+
f = f.hi_ansi_theme(this._hiAnsiTheme);
|
|
230
|
+
}
|
|
231
|
+
if (this?._csTheme) {
|
|
232
|
+
f = f.cs_theme(this._csTheme);
|
|
233
|
+
}
|
|
234
|
+
if (this?._eastAsiaTheme) {
|
|
235
|
+
f = f.east_asia_theme(this._eastAsiaTheme);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (this?._hint) {
|
|
239
|
+
f = f.hint(this._hint);
|
|
240
|
+
}
|
|
241
|
+
return f;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// @deprecated
|
|
246
|
+
export const setRunProperty = <T extends wasm.Run | wasm.Style>(
|
|
247
|
+
target: T,
|
|
248
|
+
property: RunProperty
|
|
249
|
+
): T => {
|
|
250
|
+
if (property._style && target instanceof wasm.Run) {
|
|
251
|
+
target = target.style(property._style) as T;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (typeof property._size !== "undefined") {
|
|
255
|
+
target = target.size(property._size) as T;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (property._color) {
|
|
259
|
+
target = target.color(property._color) as T;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (property._highlight) {
|
|
263
|
+
target = target.highlight(property._highlight) as T;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (property._vertAlign) {
|
|
267
|
+
if (property._vertAlign === "superscript") {
|
|
268
|
+
target = target.vert_align(wasm.VertAlignType.SuperScript) as T;
|
|
269
|
+
} else if (property._vertAlign === "subscript") {
|
|
270
|
+
target = target.vert_align(wasm.VertAlignType.SubScript) as T;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (property._bold) {
|
|
275
|
+
target = target.bold() as T;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (property._italic) {
|
|
279
|
+
target = target.italic() as T;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (property._strike) {
|
|
283
|
+
target = target.strike() as T;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (property._underline) {
|
|
287
|
+
target = target.underline(property._underline) as T;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (property._vanish) {
|
|
291
|
+
target = target.vanish() as T;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (property._characterSpacing != null) {
|
|
295
|
+
target = target.character_spacing(property._characterSpacing) as T;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (property._textBorder) {
|
|
299
|
+
const { borderType, color, space, size } = property._textBorder;
|
|
300
|
+
target = target.text_border(
|
|
301
|
+
convertBorderType(borderType),
|
|
302
|
+
size,
|
|
303
|
+
space,
|
|
304
|
+
color
|
|
305
|
+
) as T;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (property._fonts) {
|
|
309
|
+
const fonts = property._fonts.buildWasmObject();
|
|
310
|
+
target = target.fonts(fonts) as T;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return target;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// @deprecated
|
|
317
|
+
export const createRunProperty = (property: RunProperty): wasm.RunProperty => {
|
|
318
|
+
let target = wasm.createRunProperty();
|
|
319
|
+
if (property._style) {
|
|
320
|
+
target = target.style(property._style);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (typeof property._size !== "undefined") {
|
|
324
|
+
target = target.size(property._size);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (property._color) {
|
|
328
|
+
target = target.color(property._color);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (property._highlight) {
|
|
332
|
+
target = target.highlight(property._highlight);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (property._vertAlign) {
|
|
336
|
+
if (property._vertAlign === "superscript") {
|
|
337
|
+
target = target.vert_align(wasm.VertAlignType.SuperScript);
|
|
338
|
+
} else if (property._vertAlign === "subscript") {
|
|
339
|
+
target = target.vert_align(wasm.VertAlignType.SubScript);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (property._bold) {
|
|
344
|
+
target = target.bold();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (property._italic) {
|
|
348
|
+
target = target.italic();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (property._strike) {
|
|
352
|
+
target = target.strike();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (property._underline) {
|
|
356
|
+
target = target.underline(property._underline);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (property._vanish) {
|
|
360
|
+
target = target.vanish();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (property._characterSpacing != null) {
|
|
364
|
+
target = target.character_spacing(property._characterSpacing);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (property._textBorder) {
|
|
368
|
+
const { borderType, color, space, size } = property._textBorder;
|
|
369
|
+
target = target.text_border(
|
|
370
|
+
convertBorderType(borderType),
|
|
371
|
+
size,
|
|
372
|
+
space,
|
|
373
|
+
color
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (property._fonts) {
|
|
378
|
+
const fonts = property._fonts.buildWasmObject();
|
|
379
|
+
target = target.fonts(fonts);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return target;
|
|
383
|
+
};
|