Compare commits
567 Commits
Author | SHA1 | Date | |
---|---|---|---|
b7334a1ab5 | |||
9229f45d59 | |||
2bd4aacdd5 | |||
abbd695a8f | |||
f7b98bcde8 | |||
a756a7697c | |||
fd1ea5b4dc | |||
d83e089cd3 | |||
33715cc50c | |||
f3f1f2d0b1 | |||
c35e706fa8 | |||
35cebfe1a2 | |||
d04c42cbe8 | |||
8744e613ac | |||
cbeecbf3e1 | |||
f8ab2d1701 | |||
adc5c6f594 | |||
c9524cc497 | |||
90de6ba7e1 | |||
78d74ae60b | |||
579593a467 | |||
b5393dadae | |||
528ab1933e | |||
36181f8c91 | |||
45af681db1 | |||
ad6b482136 | |||
a6e1c2b019 | |||
3eb98533ae | |||
f5f021834e | |||
35702c3f77 | |||
8fbbd571ad | |||
2dd228be69 | |||
562835cfe7 | |||
6bac06e84d | |||
88436168ee | |||
0c3206d2e2 | |||
033debd339 | |||
d4f160732a | |||
4238fc9ab4 | |||
0d042b8dd1 | |||
afdd5f2d8f | |||
70c7b3d1b3 | |||
7b1cd5fe86 | |||
09ab169ffd | |||
35a82cf12e | |||
8d33cb01dd | |||
438d11dd86 | |||
d23b0d0789 | |||
1fa8c7ac82 | |||
3d6ead0359 | |||
379050dccd | |||
f9d1c197cf | |||
a89ee463e6 | |||
036caaacc8 | |||
80c37afe2b | |||
3a36d912fe | |||
c741d5d8ac | |||
0fa7dd13ad | |||
d5d80550e7 | |||
23a0a59454 | |||
066aa56f6a | |||
3997b7a5d6 | |||
ccc391607a | |||
9577192d41 | |||
968c3aed0f | |||
9c7a80729b | |||
5f26ca1c94 | |||
f2b1587bff | |||
3b9f80fb1a | |||
8da57bec51 | |||
63db9f290c | |||
e8bd4bd6c6 | |||
28d93b0c42 | |||
95f8e37006 | |||
87083cb264 | |||
1e8dc95c9c | |||
abfa242c28 | |||
56b5414152 | |||
8f46060be2 | |||
93b17ca2af | |||
66008115b8 | |||
55697a7c32 | |||
e9b259db6b | |||
55c51f7af1 | |||
4e7fd6a6dc | |||
6294ec448f | |||
668198b5d1 | |||
56b2ffe706 | |||
2ab06ffe36 | |||
0c51082bb9 | |||
9a9a2019f6 | |||
d94348f5ca | |||
4c10741862 | |||
222a25e4e2 | |||
5fd4490c4f | |||
e1cc65cb97 | |||
991f837bc1 | |||
87b3035465 | |||
4498305a6c | |||
cac7abba91 | |||
b9b55b2829 | |||
11365d5be5 | |||
47a5aff40c | |||
721fbbac67 | |||
bcca50fb40 | |||
229d2eb689 | |||
3ef80cc7b3 | |||
f1f11f36e4 | |||
28f187064e | |||
c391ca533a | |||
0ca92b80f9 | |||
84501b6038 | |||
dcd3e90b19 | |||
be7d84dfa0 | |||
b0d60109c9 | |||
b4659f9901 | |||
25f657b842 | |||
dfffb066f3 | |||
4f06d760a3 | |||
aea2531111 | |||
16707201b4 | |||
c7c9652095 | |||
05378f58ae | |||
d7549a1140 | |||
e3ee455186 | |||
210d9c58f2 | |||
db85c3dd2f | |||
4976a75ab3 | |||
414d0248f5 | |||
fa400bcf39 | |||
9e9ca526fe | |||
41c0fb5fc0 | |||
58e7dbf445 | |||
20e0213c7d | |||
b8f83fd6ad | |||
d1f75e3a42 | |||
337ff464cf | |||
cad4a5510b | |||
aa8438d8bd | |||
79363c2c2c | |||
f706d8e62d | |||
e7ee2a0fdf | |||
bd17df8e98 | |||
e237326319 | |||
a368ed7fd3 | |||
a9fa31ebac | |||
6b4a78ed41 | |||
9b93a15323 | |||
17774c50be | |||
a63095a7b4 | |||
9aba21e64c | |||
6288bb0701 | |||
2061854778 | |||
e4eeb3f87f | |||
a168dc1c15 | |||
99dee460ae | |||
36e9ac1179 | |||
df619ffe49 | |||
b1513d4ce9 | |||
7d0a71acef | |||
307a651e6d | |||
b7f6a7da6b | |||
1d9ff920e8 | |||
810846c49a | |||
cb66d68980 | |||
1badd6a53f | |||
7e37d8d27a | |||
5c950e1a07 | |||
adbb16f7eb | |||
dd088bf584 | |||
a27cb7db47 | |||
2e41387a50 | |||
9bb4803ac5 | |||
8bf2b6c9ce | |||
37f60c1766 | |||
7bce84eba0 | |||
46bedaa241 | |||
9a6d8c0e8b | |||
1571b7a1a7 | |||
16f5e5bbbc | |||
e3a8def43e | |||
40c11bae22 | |||
3a3415a3da | |||
222024fdde | |||
c5511bb3d9 | |||
5c4696a660 | |||
2812bef532 | |||
91379070d3 | |||
668f4f4e78 | |||
28ad740473 | |||
d08349f8eb | |||
b6e5b23f89 | |||
8dd8c079e7 | |||
eeee01a0e0 | |||
09ab91eeef | |||
a0a88412ff | |||
972fa77265 | |||
e69b063687 | |||
a89919397d | |||
0cbb5fb0a3 | |||
352cde743f | |||
b59fa6bb16 | |||
c0c62001fe | |||
e77a7dfdcd | |||
a26292a0fd | |||
18b2e91da2 | |||
a0437381e7 | |||
bb686bbcbe | |||
c898d0a3c3 | |||
704c678333 | |||
c59c5350fd | |||
accb1d44d0 | |||
b61f798cd9 | |||
be2ec9d4cf | |||
514fbb1c09 | |||
8ce397f61e | |||
3b0dfb8489 | |||
f4933deaf2 | |||
add2273551 | |||
91b00466a0 | |||
d0612e115e | |||
e4a6cbe887 | |||
0386810714 | |||
d4585f60b3 | |||
18f015a959 | |||
10c866bdea | |||
680c938dcf | |||
c3a617fefd | |||
6362b498a6 | |||
5e14bc6c2a | |||
2e30ab29be | |||
44568023cd | |||
c57aaa856d | |||
0f4f24c3f3 | |||
2fe7a2e3d3 | |||
20b62f5768 | |||
ab063eee08 | |||
66c7624b40 | |||
bfc302023f | |||
3505912f74 | |||
ec379f2e4d | |||
2d17954104 | |||
01c834b16b | |||
2aeb2c2e88 | |||
be88086434 | |||
28f0cc681d | |||
def29c535b | |||
168e5e6e11 | |||
ce71f19826 | |||
4fd3f3a6b8 | |||
39763d3869 | |||
36f90edc67 | |||
b0cbd6f609 | |||
d23d4a4557 | |||
07c58ee43c | |||
1037e8f1b9 | |||
f0ae8396f7 | |||
1ae5995f9c | |||
751ad9d304 | |||
0bd1514826 | |||
16bfc78d8d | |||
528008406a | |||
9e3010ac6a | |||
7c1fa6f4bf | |||
f58d31cc3d | |||
286c742ece | |||
3edc51d5a0 | |||
05d4c9688e | |||
d4401d1597 | |||
90358e73f6 | |||
a77ca02ea9 | |||
7785f0df02 | |||
0e6ed6e5ea | |||
70e84c8d38 | |||
11c3886659 | |||
6104e5bc35 | |||
c748b9a7fc | |||
714dbc0179 | |||
7f16cfc359 | |||
78757753c8 | |||
8343edcdf1 | |||
1ab9e08eb9 | |||
e1bc7f34c9 | |||
d5b495df5b | |||
d6256d2acb | |||
f1c7e448ae | |||
b600fd9324 | |||
3bf40ecb33 | |||
ffb650daa9 | |||
d2122e7806 | |||
6b6eb1d7a2 | |||
c80d881105 | |||
3c223c69e9 | |||
2420321008 | |||
29d5421cea | |||
71953cf45a | |||
325866d9c3 | |||
457e9c12e3 | |||
ff4a66466a | |||
cc142cc052 | |||
6e0dc69217 | |||
33332bcf66 | |||
b94f9ac25b | |||
0a7be48dcb | |||
3f3397620e | |||
154bc1df95 | |||
715e436c4c | |||
f5a9bcf839 | |||
31d2da86ff | |||
9dad3ca356 | |||
355e01edc6 | |||
c19bf1c404 | |||
970450074d | |||
91e8295648 | |||
3e40ae862b | |||
236cce604f | |||
0388a564b5 | |||
cd77ceba69 | |||
5ae8731abe | |||
7bb90c55d1 | |||
a07d6378e8 | |||
4fb8d277b4 | |||
73186ce920 | |||
d02f98956f | |||
d186d42bb6 | |||
338f7be967 | |||
b63a6e6e16 | |||
7e9884081e | |||
262f6323d0 | |||
811dd61562 | |||
9801879063 | |||
e30836c935 | |||
352511bb55 | |||
8ce057e25c | |||
0775ecb08b | |||
e909ab9886 | |||
e03bb155b9 | |||
91620d61d8 | |||
0fba450c9a | |||
ca604fb004 | |||
9e998d233c | |||
6c0fd3adec | |||
6ad18420e5 | |||
ef95a16f39 | |||
53861ec18d | |||
81b1569ad2 | |||
66a1992da0 | |||
100356c344 | |||
31905a27b1 | |||
08916176a2 | |||
ffb3d63c92 | |||
22005428ba | |||
a70acd6d63 | |||
af9e0b0d3f | |||
a0c2be8af2 | |||
df9d4b4219 | |||
cdf5015920 | |||
fe9b438a51 | |||
59cbf8c9cb | |||
7af8175034 | |||
bf0393b485 | |||
83a8822cf7 | |||
eada41b8a1 | |||
2c03377c47 | |||
484fc4aa2d | |||
2846014db0 | |||
c9d86619de | |||
ce485dbc29 | |||
4e875b4744 | |||
3f6c006716 | |||
f8f5d43b0c | |||
8c0fe00c6f | |||
c37d9ca5b3 | |||
f3dc1f0712 | |||
a4d96bbf6e | |||
90c40178aa | |||
2ee96b419a | |||
773900b620 | |||
ece440340f | |||
5233b4b5e6 | |||
86de252a52 | |||
c206d23480 | |||
5a53a138d9 | |||
5b5deb198e | |||
88a30e5af7 | |||
0b9ffa9a7b | |||
5052bcde4f | |||
d5409678ee | |||
72c39a9eb2 | |||
2ed7a28d1e | |||
7b2ff00c83 | |||
d5b0083d77 | |||
406183d104 | |||
c6d3e60314 | |||
be71037a13 | |||
c8c64b320b | |||
8514e8ad31 | |||
d505281a7e | |||
58575342e0 | |||
60ad6d6ab5 | |||
f9dec1cb3c | |||
ffd998cbf5 | |||
c713e6f371 | |||
3c55f9fc1f | |||
c9a8a99278 | |||
b309d327f0 | |||
58bad10bfe | |||
26ea6c518f | |||
d4594a97a2 | |||
68f951ef79 | |||
12e29c6a75 | |||
05eedb2ac1 | |||
8cbc6c15fe | |||
2c21f64b9f | |||
7ec9cff433 | |||
3f979b9981 | |||
3077ca96a7 | |||
46ded68369 | |||
b3a53d341d | |||
afcd5e70a1 | |||
ae48999e38 | |||
4c38e45455 | |||
ec847dccf9 | |||
ca47a1dc3f | |||
cc53ff417b | |||
fcba817a4a | |||
bcd8249d17 | |||
bc0a197ba1 | |||
2e16279d7b | |||
87590aedbd | |||
0fef7763d5 | |||
e55698d221 | |||
d410b5e96f | |||
8587601411 | |||
5b67cb21c6 | |||
42fd9d06de | |||
1e0b74fd27 | |||
21934ec85b | |||
b4f01fb6ec | |||
fbf6329500 | |||
41549443c3 | |||
92630af4e1 | |||
4db633da16 | |||
dac02f13ae | |||
1a52dec1c2 | |||
be1ca51162 | |||
768e20bb79 | |||
26b9b15de8 | |||
42713095b6 | |||
3acafeca38 | |||
7ca75c8c5a | |||
c00ad454a9 | |||
16d04eb4d3 | |||
816845f271 | |||
12eeda8d33 | |||
3d622c2ef1 | |||
21a6767c6f | |||
7a7326ec09 | |||
9b3af4e217 | |||
cee0114f81 | |||
03399aedf0 | |||
2739b94bd8 | |||
c720441d62 | |||
00b5898fe0 | |||
0d0940b7a5 | |||
f28c949ac6 | |||
63317d6ac8 | |||
6406ba831f | |||
7a7575964a | |||
d75c833717 | |||
40344b57d9 | |||
6fc26d1da3 | |||
a012a0e418 | |||
bf1a2f3059 | |||
ca316b4e6d | |||
1fb5c581c9 | |||
efa64b451a | |||
38059ea6b9 | |||
c2110622ca | |||
0452959b85 | |||
0eca8389b6 | |||
66e043137b | |||
d684654625 | |||
7749f6b20f | |||
15c9c0ae3e | |||
74fddc2ada | |||
cff866ecdc | |||
e952c02c83 | |||
546983c6ba | |||
c7134564a3 | |||
984a3573eb | |||
defe94a2b2 | |||
e23c8c4b46 | |||
7941ff487a | |||
7b7df33a0f | |||
68b04f2511 | |||
db3e017a7d | |||
c21d45a79e | |||
6defb686bb | |||
f68796dae1 | |||
b1872bcb95 | |||
3006f4d2c1 | |||
7f88a38219 | |||
aeb2487c70 | |||
e42e50dd39 | |||
f4572b9720 | |||
7646f3a845 | |||
e4e5b1e4f6 | |||
a481518470 | |||
2435ebf16e | |||
414fa70e5d | |||
f255d4c141 | |||
4513bb529b | |||
5907132062 | |||
69bf313f18 | |||
fe8b0a6b2b | |||
abcfd79f2f | |||
41e3b078ec | |||
4eb2f92c1f | |||
9bfb5bf681 | |||
473ad2947c | |||
ee28f6ad84 | |||
11bebd42ac | |||
49b4ca67e0 | |||
3282f762df | |||
d335106b46 | |||
cefa01f7ec | |||
b7ba2b3306 | |||
03d5152e7c | |||
af3b7f2613 | |||
1405841565 | |||
211d2dc0d6 | |||
82f431465f | |||
247afe56ce | |||
91e874eee5 | |||
ff67c3660b | |||
58c580b9ca | |||
a9da151026 | |||
83c72d0dbb | |||
2c31367851 | |||
3b618f3a2c | |||
4c5bc6232d | |||
694835bdac | |||
c8b75c19da | |||
c0181aa83a | |||
c5b615ae2a | |||
54cbd56f42 | |||
c8914a109e | |||
8509bccc4f | |||
4ce53a3d76 | |||
ec69f9ac07 | |||
5a4fe5d5da | |||
e6af9b4b73 | |||
361f9231d8 | |||
4215932550 | |||
29da523579 | |||
fbb4d7cfde | |||
323895f0ab | |||
32a5cca878 | |||
911c705b59 | |||
594c8d72b8 | |||
7ea5232b22 | |||
be12d61795 | |||
925340eb3d | |||
601a4038f4 | |||
e0576c889b | |||
4ff7f0a7bd |
55
.cspell.json
55
.cspell.json
@ -7,31 +7,36 @@
|
|||||||
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
||||||
// words - list of words to be always considered correct
|
// words - list of words to be always considered correct
|
||||||
"words": [
|
"words": [
|
||||||
"Xmlable",
|
"Abjad",
|
||||||
|
"aiueo",
|
||||||
|
"ATLEAST",
|
||||||
|
"chosung",
|
||||||
|
"clippy",
|
||||||
|
"datas",
|
||||||
|
"docsify",
|
||||||
|
"dolan",
|
||||||
|
"execa",
|
||||||
|
"falsey",
|
||||||
|
"horz",
|
||||||
|
"iife",
|
||||||
|
"Initializable",
|
||||||
|
"iroha",
|
||||||
|
"jsonify",
|
||||||
|
"jszip",
|
||||||
|
"NUMPAGES",
|
||||||
|
"odttf",
|
||||||
|
"ondata",
|
||||||
|
"onfile",
|
||||||
|
"ooxml",
|
||||||
|
"panose",
|
||||||
|
"rels",
|
||||||
|
"rsid",
|
||||||
"twip",
|
"twip",
|
||||||
"twips",
|
"twips",
|
||||||
"jsonify",
|
"Xmlable",
|
||||||
"falsey",
|
|
||||||
"aiueo",
|
|
||||||
"iroha",
|
|
||||||
"aiueo",
|
|
||||||
"iroha",
|
|
||||||
"chosung",
|
|
||||||
"Abjad",
|
|
||||||
"Initializable",
|
|
||||||
"rels",
|
|
||||||
"dolan",
|
|
||||||
"xmlify",
|
|
||||||
"Xmlifyed",
|
|
||||||
"xmlified",
|
"xmlified",
|
||||||
"datas",
|
"xmlify",
|
||||||
"jszip",
|
"Xmlifyed"
|
||||||
"rsid",
|
|
||||||
"NUMPAGES",
|
|
||||||
"ATLEAST",
|
|
||||||
"ooxml",
|
|
||||||
"clippy",
|
|
||||||
"docsify"
|
|
||||||
],
|
],
|
||||||
"ignoreRegExpList": [
|
"ignoreRegExpList": [
|
||||||
"/\"w:.+\"/",
|
"/\"w:.+\"/",
|
||||||
@ -47,9 +52,11 @@
|
|||||||
"/xmlKeys = {[^}]+}/g",
|
"/xmlKeys = {[^}]+}/g",
|
||||||
"/\\.to\\.deep\\.equal\\({[^)]+}\\)/g",
|
"/\\.to\\.deep\\.equal\\({[^)]+}\\)/g",
|
||||||
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
||||||
"/new [a-zA-Z]+\\({[^£]+}\\)/g"
|
"/new [a-zA-Z]+\\({[^£]+}\\)/g",
|
||||||
|
"/<element name=\"[a-z]+\"/gi",
|
||||||
|
"/<attribute name=\"[a-z]+\"/gi"
|
||||||
],
|
],
|
||||||
"ignorePaths": ["package.json", "docs/api"],
|
"ignorePaths": ["package.json", "docs/api", "*.docx", "build"],
|
||||||
"allowCompoundWords": true,
|
"allowCompoundWords": true,
|
||||||
// flagWords - list of words to be always considered incorrect
|
// flagWords - list of words to be always considered incorrect
|
||||||
// This is useful for offensive words and common spelling errors.
|
// This is useful for offensive words and common spelling errors.
|
||||||
|
270
.eslintrc.js
270
.eslintrc.js
@ -1,270 +0,0 @@
|
|||||||
/*
|
|
||||||
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
|
|
||||||
https://github.com/typescript-eslint/tslint-to-eslint-config
|
|
||||||
|
|
||||||
It represents the closest reasonable ESLint configuration to this
|
|
||||||
project's original TSLint configuration.
|
|
||||||
|
|
||||||
We recommend eventually switching this configuration to extend from
|
|
||||||
the recommended rulesets in typescript-eslint.
|
|
||||||
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
|
|
||||||
|
|
||||||
Happy linting! 💖
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
extends: "eslint:recommended",
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es6: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
parserOptions: {
|
|
||||||
project: "tsconfig.json",
|
|
||||||
sourceType: "module",
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
"eslint-plugin-import",
|
|
||||||
"eslint-plugin-no-null",
|
|
||||||
"eslint-plugin-unicorn",
|
|
||||||
"eslint-plugin-jsdoc",
|
|
||||||
"eslint-plugin-prefer-arrow",
|
|
||||||
"@typescript-eslint",
|
|
||||||
"functional",
|
|
||||||
],
|
|
||||||
root: true,
|
|
||||||
rules: {
|
|
||||||
"no-undef": "off",
|
|
||||||
"no-extra-boolean-cast": "off",
|
|
||||||
"no-alert": "error",
|
|
||||||
"no-self-compare": "error",
|
|
||||||
"no-unreachable-loop": "error",
|
|
||||||
"no-template-curly-in-string": "error",
|
|
||||||
"no-unused-private-class-members": "error",
|
|
||||||
"no-extend-native": "error",
|
|
||||||
"no-floating-decimal": "error",
|
|
||||||
"no-implied-eval": "error",
|
|
||||||
"no-iterator": "error",
|
|
||||||
"no-lone-blocks": "error",
|
|
||||||
"no-loop-func": "error",
|
|
||||||
"no-new-object": "error",
|
|
||||||
"no-proto": "error",
|
|
||||||
"no-useless-catch": "error",
|
|
||||||
"one-var-declaration-per-line": "error",
|
|
||||||
"prefer-arrow-callback": "error",
|
|
||||||
"prefer-destructuring": "error",
|
|
||||||
"prefer-exponentiation-operator": "error",
|
|
||||||
"prefer-promise-reject-errors": "error",
|
|
||||||
"prefer-regex-literals": "error",
|
|
||||||
"prefer-spread": "error",
|
|
||||||
"prefer-template": "error",
|
|
||||||
"require-await": "error",
|
|
||||||
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
||||||
"@typescript-eslint/array-type": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
default: "array",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/ban-types": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
types: {
|
|
||||||
Object: {
|
|
||||||
message: "Avoid using the `Object` type. Did you mean `object`?",
|
|
||||||
},
|
|
||||||
Function: {
|
|
||||||
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
|
|
||||||
},
|
|
||||||
Boolean: {
|
|
||||||
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
|
|
||||||
},
|
|
||||||
Number: {
|
|
||||||
message: "Avoid using the `Number` type. Did you mean `number`?",
|
|
||||||
},
|
|
||||||
String: {
|
|
||||||
message: "Avoid using the `String` type. Did you mean `string`?",
|
|
||||||
},
|
|
||||||
Symbol: {
|
|
||||||
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/consistent-type-assertions": "error",
|
|
||||||
"@typescript-eslint/dot-notation": "error",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
allowExpressions: false,
|
|
||||||
allowTypedFunctionExpressions: false,
|
|
||||||
allowHigherOrderFunctions: false,
|
|
||||||
allowDirectConstAssertionInArrowFunctions: true,
|
|
||||||
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
accessibility: "explicit",
|
|
||||||
overrides: {
|
|
||||||
accessors: "explicit",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/explicit-module-boundary-types": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
allowArgumentsExplicitlyTypedAsAny: true,
|
|
||||||
allowDirectConstAssertionInArrowFunctions: true,
|
|
||||||
allowHigherOrderFunctions: false,
|
|
||||||
allowTypedFunctionExpressions: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/naming-convention": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
selector: ["objectLiteralProperty"],
|
|
||||||
leadingUnderscore: "allow",
|
|
||||||
format: ["camelCase", "PascalCase"],
|
|
||||||
filter: {
|
|
||||||
regex: "(^[a-z]+:.+)|_attr|[0-9]",
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-empty-function": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-parameter-properties": "off",
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/no-shadow": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
hoist: "all",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-this-alias": "error",
|
|
||||||
"@typescript-eslint/no-unused-expressions": "error",
|
|
||||||
"@typescript-eslint/no-use-before-define": "off",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "error",
|
|
||||||
"@typescript-eslint/prefer-function-type": "error",
|
|
||||||
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
||||||
"@typescript-eslint/prefer-readonly": "error",
|
|
||||||
"@typescript-eslint/triple-slash-reference": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
path: "always",
|
|
||||||
types: "prefer-import",
|
|
||||||
lib: "always",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/typedef": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
parameter: true,
|
|
||||||
propertyDeclaration: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@typescript-eslint/unified-signatures": "error",
|
|
||||||
"arrow-body-style": "error",
|
|
||||||
complexity: "off",
|
|
||||||
"consistent-return": "error",
|
|
||||||
"constructor-super": "error",
|
|
||||||
curly: "error",
|
|
||||||
"dot-notation": "off",
|
|
||||||
eqeqeq: ["error", "smart"],
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"id-denylist": ["error", "any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"],
|
|
||||||
"id-match": "error",
|
|
||||||
"import/no-default-export": "error",
|
|
||||||
"import/no-extraneous-dependencies": "off",
|
|
||||||
"import/no-internal-modules": "off",
|
|
||||||
"import/order": "error",
|
|
||||||
indent: "off",
|
|
||||||
"jsdoc/check-alignment": "error",
|
|
||||||
"jsdoc/check-indentation": "off",
|
|
||||||
"jsdoc/newline-after-description": "error",
|
|
||||||
"max-classes-per-file": "off",
|
|
||||||
"max-len": "off",
|
|
||||||
"new-parens": "error",
|
|
||||||
"no-bitwise": "error",
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-cond-assign": "error",
|
|
||||||
"no-console": "error",
|
|
||||||
"no-debugger": "error",
|
|
||||||
"no-duplicate-case": "error",
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
"no-empty": "error",
|
|
||||||
"no-empty-function": "off",
|
|
||||||
"no-eval": "error",
|
|
||||||
"no-extra-bind": "error",
|
|
||||||
"no-fallthrough": "off",
|
|
||||||
"no-invalid-this": "off",
|
|
||||||
"no-multiple-empty-lines": "error",
|
|
||||||
"no-new-func": "error",
|
|
||||||
"no-new-wrappers": "error",
|
|
||||||
"no-null/no-null": "error",
|
|
||||||
"no-param-reassign": "error",
|
|
||||||
"no-redeclare": "error",
|
|
||||||
"no-return-await": "error",
|
|
||||||
"no-sequences": "error",
|
|
||||||
"no-shadow": "off",
|
|
||||||
"no-sparse-arrays": "error",
|
|
||||||
"no-template-curly-in-string": "error",
|
|
||||||
"no-throw-literal": "error",
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"no-undef-init": "error",
|
|
||||||
"no-underscore-dangle": ["error", { allow: ["_attr"] }],
|
|
||||||
"no-unsafe-finally": "error",
|
|
||||||
"no-unused-expressions": "off",
|
|
||||||
"no-unused-labels": "error",
|
|
||||||
"no-use-before-define": "off",
|
|
||||||
"no-useless-constructor": "error",
|
|
||||||
"no-var": "error",
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"one-var": ["error", "never"],
|
|
||||||
"prefer-arrow/prefer-arrow-functions": "error",
|
|
||||||
"prefer-const": "error",
|
|
||||||
"prefer-object-spread": "error",
|
|
||||||
radix: "error",
|
|
||||||
"space-in-parens": ["error", "never"],
|
|
||||||
"spaced-comment": [
|
|
||||||
"error",
|
|
||||||
"always",
|
|
||||||
{
|
|
||||||
markers: ["/"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"unicorn/filename-case": "error",
|
|
||||||
"unicorn/prefer-ternary": "error",
|
|
||||||
"use-isnan": "error",
|
|
||||||
"valid-typeof": "off",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
|
||||||
"functional/immutable-data": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
assumeTypes: true,
|
|
||||||
ignoreImmediateMutation: true,
|
|
||||||
ignoreAccessorPattern: ["**.root*", "**.numberingReferences*", "**.sections*", "**.properties*"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"functional/no-method-signature": "error",
|
|
||||||
"functional/no-mixed-type": "error",
|
|
||||||
"functional/prefer-readonly-type": "error",
|
|
||||||
"no-unused-vars": ["error", { argsIgnorePattern: "^[_]+$" }],
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ["*.spec.ts"],
|
|
||||||
rules: {
|
|
||||||
"@typescript-eslint/no-unused-expressions": "off",
|
|
||||||
"@typescript-eslint/dot-notation": "off",
|
|
||||||
"prefer-destructuring": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
237
.eslintrc.yml
Normal file
237
.eslintrc.yml
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
extends: eslint:recommended
|
||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
es6: true
|
||||||
|
node: true
|
||||||
|
parser: "@typescript-eslint/parser"
|
||||||
|
parserOptions:
|
||||||
|
project:
|
||||||
|
- tsconfig.json
|
||||||
|
sourceType: module
|
||||||
|
plugins:
|
||||||
|
- eslint-plugin-import
|
||||||
|
- eslint-plugin-no-null
|
||||||
|
- eslint-plugin-unicorn
|
||||||
|
- eslint-plugin-jsdoc
|
||||||
|
- eslint-plugin-prefer-arrow
|
||||||
|
- "@typescript-eslint"
|
||||||
|
- eslint-plugin-functional
|
||||||
|
root: true
|
||||||
|
rules:
|
||||||
|
no-undef: "off"
|
||||||
|
no-extra-boolean-cast: "off"
|
||||||
|
no-alert: error
|
||||||
|
no-self-compare: error
|
||||||
|
no-unreachable-loop: error
|
||||||
|
no-template-curly-in-string: error
|
||||||
|
no-unused-private-class-members: error
|
||||||
|
no-extend-native: error
|
||||||
|
no-floating-decimal: error
|
||||||
|
no-implied-eval: error
|
||||||
|
no-iterator: error
|
||||||
|
no-lone-blocks: error
|
||||||
|
no-loop-func: error
|
||||||
|
no-new-object: error
|
||||||
|
no-proto: error
|
||||||
|
no-useless-catch: error
|
||||||
|
one-var-declaration-per-line: error
|
||||||
|
prefer-arrow-callback: error
|
||||||
|
prefer-destructuring: error
|
||||||
|
prefer-exponentiation-operator: error
|
||||||
|
prefer-promise-reject-errors: error
|
||||||
|
prefer-regex-literals: error
|
||||||
|
prefer-spread: error
|
||||||
|
prefer-template: error
|
||||||
|
require-await: error
|
||||||
|
"@typescript-eslint/adjacent-overload-signatures": error
|
||||||
|
"@typescript-eslint/array-type":
|
||||||
|
- error
|
||||||
|
- default: array
|
||||||
|
"@typescript-eslint/ban-types":
|
||||||
|
- error
|
||||||
|
- types:
|
||||||
|
Object:
|
||||||
|
message: Avoid using the `Object` type. Did you mean `object`?
|
||||||
|
Function:
|
||||||
|
message: >-
|
||||||
|
Avoid using the `Function` type. Prefer a specific function type,
|
||||||
|
like `() => void`.
|
||||||
|
Boolean:
|
||||||
|
message: Avoid using the `Boolean` type. Did you mean `boolean`?
|
||||||
|
Number:
|
||||||
|
message: Avoid using the `Number` type. Did you mean `number`?
|
||||||
|
String:
|
||||||
|
message: Avoid using the `String` type. Did you mean `string`?
|
||||||
|
Symbol:
|
||||||
|
message: Avoid using the `Symbol` type. Did you mean `symbol`?
|
||||||
|
"@typescript-eslint/consistent-type-assertions": error
|
||||||
|
"@typescript-eslint/dot-notation": error
|
||||||
|
"@typescript-eslint/explicit-function-return-type":
|
||||||
|
- error
|
||||||
|
- allowExpressions: true
|
||||||
|
allowTypedFunctionExpressions: true
|
||||||
|
allowHigherOrderFunctions: false
|
||||||
|
allowDirectConstAssertionInArrowFunctions: true
|
||||||
|
allowConciseArrowFunctionExpressionsStartingWithVoid: true
|
||||||
|
"@typescript-eslint/explicit-member-accessibility":
|
||||||
|
- error
|
||||||
|
- accessibility: explicit
|
||||||
|
overrides:
|
||||||
|
accessors: explicit
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types":
|
||||||
|
- error
|
||||||
|
- allowArgumentsExplicitlyTypedAsAny: true
|
||||||
|
allowDirectConstAssertionInArrowFunctions: true
|
||||||
|
allowHigherOrderFunctions: false
|
||||||
|
allowTypedFunctionExpressions: false
|
||||||
|
"@typescript-eslint/naming-convention":
|
||||||
|
- error
|
||||||
|
- selector:
|
||||||
|
- objectLiteralProperty
|
||||||
|
leadingUnderscore: allow
|
||||||
|
format:
|
||||||
|
- camelCase
|
||||||
|
- PascalCase
|
||||||
|
filter:
|
||||||
|
regex: (^[a-z]+:.+)|_attr|[0-9]
|
||||||
|
match: false
|
||||||
|
"@typescript-eslint/no-empty-function": error
|
||||||
|
"@typescript-eslint/no-empty-interface": error
|
||||||
|
"@typescript-eslint/no-explicit-any": error
|
||||||
|
"@typescript-eslint/no-misused-new": error
|
||||||
|
"@typescript-eslint/no-namespace": error
|
||||||
|
"@typescript-eslint/no-parameter-properties": "off"
|
||||||
|
"@typescript-eslint/no-require-imports": error
|
||||||
|
"@typescript-eslint/no-shadow":
|
||||||
|
- error
|
||||||
|
- hoist: all
|
||||||
|
"@typescript-eslint/no-this-alias": error
|
||||||
|
"@typescript-eslint/no-unused-expressions": error
|
||||||
|
"@typescript-eslint/no-use-before-define": "off"
|
||||||
|
"@typescript-eslint/no-var-requires": error
|
||||||
|
"@typescript-eslint/prefer-for-of": error
|
||||||
|
"@typescript-eslint/prefer-function-type": error
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": error
|
||||||
|
"@typescript-eslint/prefer-readonly": error
|
||||||
|
"@typescript-eslint/triple-slash-reference":
|
||||||
|
- error
|
||||||
|
- path: always
|
||||||
|
types: prefer-import
|
||||||
|
lib: always
|
||||||
|
"@typescript-eslint/typedef":
|
||||||
|
- error
|
||||||
|
- parameter: true
|
||||||
|
propertyDeclaration: true
|
||||||
|
"@typescript-eslint/unified-signatures": error
|
||||||
|
arrow-body-style: error
|
||||||
|
complexity: "off"
|
||||||
|
consistent-return: error
|
||||||
|
constructor-super: error
|
||||||
|
curly: error
|
||||||
|
dot-notation: "off"
|
||||||
|
eqeqeq:
|
||||||
|
- error
|
||||||
|
- smart
|
||||||
|
guard-for-in: error
|
||||||
|
id-denylist:
|
||||||
|
- error
|
||||||
|
- any
|
||||||
|
- Number
|
||||||
|
- number
|
||||||
|
- String
|
||||||
|
- string
|
||||||
|
- Boolean
|
||||||
|
- boolean
|
||||||
|
- Undefined
|
||||||
|
- undefined
|
||||||
|
id-match: error
|
||||||
|
import/no-default-export: error
|
||||||
|
import/no-extraneous-dependencies: "off"
|
||||||
|
import/no-internal-modules: "off"
|
||||||
|
import/order: error
|
||||||
|
indent: "off"
|
||||||
|
jsdoc/check-alignment: error
|
||||||
|
jsdoc/check-indentation: "off"
|
||||||
|
max-classes-per-file: "off"
|
||||||
|
max-len: "off"
|
||||||
|
new-parens: error
|
||||||
|
no-bitwise: error
|
||||||
|
no-caller: error
|
||||||
|
no-cond-assign: error
|
||||||
|
no-console: error
|
||||||
|
no-debugger: error
|
||||||
|
no-duplicate-case: error
|
||||||
|
no-duplicate-imports: error
|
||||||
|
no-empty: error
|
||||||
|
no-empty-function: "off"
|
||||||
|
no-eval: error
|
||||||
|
no-extra-bind: error
|
||||||
|
no-fallthrough: "off"
|
||||||
|
no-invalid-this: "off"
|
||||||
|
no-multiple-empty-lines: error
|
||||||
|
no-new-func: error
|
||||||
|
no-new-wrappers: error
|
||||||
|
no-null/no-null: error
|
||||||
|
no-param-reassign: error
|
||||||
|
no-redeclare: error
|
||||||
|
no-return-await: error
|
||||||
|
no-sequences: error
|
||||||
|
no-shadow: "off"
|
||||||
|
no-sparse-arrays: error
|
||||||
|
no-throw-literal: error
|
||||||
|
no-trailing-spaces: error
|
||||||
|
no-undef-init: error
|
||||||
|
no-underscore-dangle:
|
||||||
|
- error
|
||||||
|
- allow:
|
||||||
|
- _attr
|
||||||
|
no-unsafe-finally: error
|
||||||
|
no-unused-expressions: "off"
|
||||||
|
no-unused-labels: error
|
||||||
|
no-use-before-define: "off"
|
||||||
|
no-useless-constructor: error
|
||||||
|
no-var: error
|
||||||
|
object-shorthand: "off"
|
||||||
|
one-var:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
prefer-arrow/prefer-arrow-functions: error
|
||||||
|
prefer-const: error
|
||||||
|
prefer-object-spread: error
|
||||||
|
radix: error
|
||||||
|
space-in-parens:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
spaced-comment:
|
||||||
|
- error
|
||||||
|
- always
|
||||||
|
- markers:
|
||||||
|
- /
|
||||||
|
unicorn/filename-case: error
|
||||||
|
unicorn/prefer-ternary: error
|
||||||
|
use-isnan: error
|
||||||
|
valid-typeof: "off"
|
||||||
|
functional/immutable-data:
|
||||||
|
- error
|
||||||
|
- ignoreImmediateMutation: true
|
||||||
|
ignoreAccessorPattern:
|
||||||
|
- "**.root*"
|
||||||
|
- "**.numberingReferences*"
|
||||||
|
- "**.sections*"
|
||||||
|
- "**.properties*"
|
||||||
|
functional/prefer-property-signatures: error
|
||||||
|
functional/no-mixed-types: error
|
||||||
|
functional/prefer-readonly-type: error
|
||||||
|
no-unused-vars:
|
||||||
|
- error
|
||||||
|
- argsIgnorePattern: ^[_]+$
|
||||||
|
ignorePatterns:
|
||||||
|
- vite.config.ts
|
||||||
|
overrides:
|
||||||
|
- files:
|
||||||
|
- "*.spec.ts"
|
||||||
|
rules:
|
||||||
|
"@typescript-eslint/no-unused-expressions": "off"
|
||||||
|
"@typescript-eslint/dot-notation": "off"
|
||||||
|
prefer-destructuring: "off"
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off"
|
33
.github/dependabot.yml
vendored
33
.github/dependabot.yml
vendored
@ -5,36 +5,3 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
ignore:
|
|
||||||
- dependency-name: "@types/node"
|
|
||||||
versions:
|
|
||||||
- 14.14.22
|
|
||||||
- 14.14.24
|
|
||||||
- 14.14.25
|
|
||||||
- 14.14.26
|
|
||||||
- 14.14.28
|
|
||||||
- 14.14.29
|
|
||||||
- 14.14.30
|
|
||||||
- 15.0.0
|
|
||||||
- dependency-name: webpack
|
|
||||||
versions:
|
|
||||||
- 5.31.2
|
|
||||||
- 5.35.0
|
|
||||||
- dependency-name: ts-loader
|
|
||||||
versions:
|
|
||||||
- 9.1.0
|
|
||||||
- dependency-name: awesome-typescript-loader
|
|
||||||
versions:
|
|
||||||
- 5.2.1
|
|
||||||
- dependency-name: chai
|
|
||||||
versions:
|
|
||||||
- 4.2.0
|
|
||||||
- 4.3.0
|
|
||||||
- 4.3.1
|
|
||||||
- 4.3.3
|
|
||||||
- dependency-name: replace-in-file
|
|
||||||
versions:
|
|
||||||
- 6.1.0
|
|
||||||
- dependency-name: "@types/chai"
|
|
||||||
versions:
|
|
||||||
- 4.2.14
|
|
||||||
|
4
.github/workflows/default.yml
vendored
4
.github/workflows/default.yml
vendored
@ -32,9 +32,9 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm run test.coverage
|
run: npm run test.ci
|
||||||
- name: Codecov
|
- name: Codecov
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
verbose: true
|
verbose: true
|
||||||
|
245
.github/workflows/demos.yml
vendored
245
.github/workflows/demos.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
name: build
|
name: build
|
||||||
path: build
|
path: build
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/1-basic.ts
|
run: npm run run-ts -- ./demo/1-basic.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -47,7 +47,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/2-declaritive-styles.ts
|
run: npm run run-ts -- ./demo/2-declaritive-styles.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts
|
run: npm run run-ts -- ./demo/3-numbering-and-bullet-points.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -65,7 +65,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/4-basic-table.ts
|
run: npm run run-ts -- ./demo/4-basic-table.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -74,7 +74,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/5-images.ts
|
run: npm run run-ts -- ./demo/5-images.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -83,7 +83,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/6-page-borders.ts
|
run: npm run run-ts -- ./demo/6-page-borders.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -92,7 +92,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/7-landscape.ts
|
run: npm run run-ts -- ./demo/7-landscape.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -101,7 +101,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/8-header-footer.ts
|
run: npm run run-ts -- ./demo/8-header-footer.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -110,7 +110,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/9-images-in-header-and-footer.ts
|
run: npm run run-ts -- ./demo/9-images-in-header-and-footer.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -119,7 +119,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/10-my-cv.ts
|
run: npm run run-ts -- ./demo/10-my-cv.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/11-declaritive-styles-2.ts
|
run: npm run run-ts -- ./demo/11-declaritive-styles-2.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -137,7 +137,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/12-scaling-images.ts
|
run: npm run run-ts -- ./demo/12-scaling-images.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -146,7 +146,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/13-xml-styles.ts
|
run: npm run run-ts -- ./demo/13-xml-styles.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -155,7 +155,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/14-page-numbers.ts
|
run: npm run run-ts -- ./demo/14-page-numbers.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -164,7 +164,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/15-page-break-before.ts
|
run: npm run run-ts -- ./demo/15-page-break-before.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -173,7 +173,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/16-multiple-sections.ts
|
run: npm run run-ts -- ./demo/16-multiple-sections.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -182,7 +182,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/17-footnotes.ts
|
run: npm run run-ts -- ./demo/17-footnotes.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
||||||
@ -192,7 +192,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/18-image-from-buffer.ts
|
run: npm run run-ts -- ./demo/18-image-from-buffer.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -201,7 +201,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/19-export-to-base64.ts
|
run: npm run run-ts -- ./demo/19-export-to-base64.ts
|
||||||
# Base 64 No longer works, abruptly. Node issue?
|
# Base 64 No longer works, abruptly. Node issue?
|
||||||
# - name: Extract Word Document
|
# - name: Extract Word Document
|
||||||
# run: npm run extract
|
# run: npm run extract
|
||||||
@ -211,7 +211,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/20-table-cell-borders.ts
|
run: npm run run-ts -- ./demo/20-table-cell-borders.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -220,7 +220,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/21-bookmarks.ts
|
run: npm run run-ts -- ./demo/21-bookmarks.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# Bad ID - need numeric ID
|
# Bad ID - need numeric ID
|
||||||
@ -230,7 +230,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/22-right-to-left-text.ts
|
run: npm run run-ts -- ./demo/22-right-to-left-text.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -239,7 +239,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/23-base64-images.ts
|
run: npm run run-ts -- ./demo/23-base64-images.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -248,7 +248,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/24-images-to-table-cell.ts
|
run: npm run run-ts -- ./demo/24-images-to-table-cell.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -257,7 +257,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/25-table-xml-styles.ts
|
run: npm run run-ts -- ./demo/25-table-xml-styles.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -266,7 +266,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/26-paragraph-borders.ts
|
run: npm run run-ts -- ./demo/26-paragraph-borders.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -275,7 +275,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/27-declaritive-styles-3.ts
|
run: npm run run-ts -- ./demo/27-declaritive-styles-3.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -284,7 +284,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/28-table-of-contents.ts
|
run: npm run run-ts -- ./demo/28-table-of-contents.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -293,7 +293,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/29-numbered-lists.ts
|
run: npm run run-ts -- ./demo/29-numbered-lists.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -302,7 +302,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/30-template-document.ts
|
run: npm run run-ts -- ./demo/31-tables.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -311,7 +311,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/31-tables.ts
|
run: npm run run-ts -- ./demo/32-merge-and-shade-table-cells.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -320,7 +320,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts
|
run: npm run run-ts -- ./demo/33-sequential-captions.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -329,16 +329,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/33-sequential-captions.ts
|
run: npm run run-ts -- ./demo/34-floating-tables.ts
|
||||||
- name: Extract Word Document
|
|
||||||
run: npm run extract
|
|
||||||
- name: Validate XML
|
|
||||||
uses: ChristophWurst/xmllint-action@v1
|
|
||||||
with:
|
|
||||||
xml-file: build/extracted-doc/word/document.xml
|
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
|
||||||
- name: Run Demo
|
|
||||||
run: npm run ts-node -- ./demo/34-floating-tables.ts
|
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr', attribute 'overlap': The attribute 'overlap' is not allowed.
|
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr', attribute 'overlap': The attribute 'overlap' is not allowed.
|
||||||
@ -349,7 +340,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/35-hyperlinks.ts
|
run: npm run run-ts -- ./demo/35-hyperlinks.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -358,7 +349,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/36-image-to-table-cell.ts
|
run: npm run run-ts -- ./demo/36-image-to-table-cell.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -367,7 +358,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/37-images-to-header-and-footer.ts
|
run: npm run run-ts -- ./demo/37-images-to-header-and-footer.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -376,7 +367,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/38-text-wrapping.ts
|
run: npm run run-ts -- ./demo/38-text-wrapping.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -385,7 +376,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/39-page-numbers.ts
|
run: npm run run-ts -- ./demo/39-page-numbers.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -394,7 +385,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/40-line-numbers.ts
|
run: npm run run-ts -- ./demo/40-line-numbers.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -403,7 +394,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/41-merge-table-cells-2.ts
|
run: npm run run-ts -- ./demo/41-merge-table-cells-2.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -412,7 +403,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/42-restart-page-numbers.ts
|
run: npm run run-ts -- ./demo/42-restart-page-numbers.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -421,7 +412,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/43-images-to-table-cell-2.ts
|
run: npm run run-ts -- ./demo/43-images-to-table-cell-2.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -430,7 +421,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/44-multiple-columns.ts
|
run: npm run run-ts -- ./demo/44-multiple-columns.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -439,7 +430,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/45-highlighting-text.ts
|
run: npm run run-ts -- ./demo/45-highlighting-text.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -448,7 +439,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/46-shading-text.ts
|
run: npm run run-ts -- ./demo/46-shading-text.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -457,7 +448,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/47-number-of-total-pages-section.ts
|
run: npm run run-ts -- ./demo/47-number-of-total-pages-section.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -466,7 +457,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/48-vertical-align.ts
|
run: npm run run-ts -- ./demo/48-vertical-align.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -475,7 +466,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/49-table-borders.ts
|
run: npm run run-ts -- ./demo/49-table-borders.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -484,7 +475,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/50-readme-demo.ts
|
run: npm run run-ts -- ./demo/50-readme-demo.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -493,7 +484,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/51-character-styles.ts
|
run: npm run run-ts -- ./demo/51-character-styles.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -502,7 +493,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/52-japanese.ts
|
run: npm run run-ts -- ./demo/52-japanese.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -511,7 +502,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/53-chinese.ts
|
run: npm run run-ts -- ./demo/53-chinese.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -520,7 +511,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/54-custom-properties.ts
|
run: npm run run-ts -- ./demo/54-custom-properties.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -529,7 +520,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/55-math.ts
|
run: npm run run-ts -- ./demo/55-math.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
#: element subHide: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}subHide': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}ctrlPr ).
|
#: element subHide: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}subHide': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}ctrlPr ).
|
||||||
@ -542,7 +533,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/56-background-color.ts
|
run: npm run run-ts -- ./demo/56-background-color.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -551,7 +542,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/57-add-parent-numbered-lists.ts
|
run: npm run run-ts -- ./demo/57-add-parent-numbered-lists.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -560,7 +551,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/58-section-types.ts
|
run: npm run run-ts -- ./demo/58-section-types.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -569,7 +560,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/59-header-footer-margins.ts
|
run: npm run run-ts -- ./demo/59-header-footer-margins.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -578,7 +569,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/60-track-revisions.ts
|
run: npm run run-ts -- ./demo/60-track-revisions.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
||||||
@ -588,7 +579,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/61-text-frame.ts
|
run: npm run run-ts -- ./demo/61-text-frame.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# element left: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}left': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}right, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}between, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}bar ).
|
# element left: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}left': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}right, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}between, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}bar ).
|
||||||
@ -598,7 +589,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/62-paragraph-spacing.ts
|
run: npm run run-ts -- ./demo/62-paragraph-spacing.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -607,7 +598,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/63-odd-even-header-footer.ts
|
run: npm run run-ts -- ./demo/63-odd-even-header-footer.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -616,7 +607,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/64-complex-numbering-text.ts
|
run: npm run run-ts -- ./demo/64-complex-numbering-text.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -625,7 +616,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/65-page-sizes.ts
|
run: npm run run-ts -- ./demo/65-page-sizes.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -634,7 +625,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/66-fields.ts
|
run: npm run run-ts -- ./demo/66-fields.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
# element bookmarkStart: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
# element bookmarkStart: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
||||||
@ -645,7 +636,7 @@ jobs:
|
|||||||
# xml-file: build/extracted-doc/word/document.xml
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/67-column-break.ts
|
run: npm run run-ts -- ./demo/67-column-break.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -654,7 +645,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/68-numbering-instances-and-starting-number.ts
|
run: npm run run-ts -- ./demo/68-numbering-instances-and-starting-number.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -663,7 +654,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/69-different-width-columns.ts
|
run: npm run run-ts -- ./demo/69-different-width-columns.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -672,7 +663,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/70-line-numbers-suppression.ts
|
run: npm run run-ts -- ./demo/70-line-numbers-suppression.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -681,7 +672,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/71-page-borders-2.ts
|
run: npm run run-ts -- ./demo/71-page-borders-2.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -690,7 +681,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/72-word-wrap.ts
|
run: npm run run-ts -- ./demo/72-word-wrap.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -699,7 +690,7 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/73-comments.ts
|
run: npm run run-ts -- ./demo/73-comments.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
@ -708,7 +699,97 @@ jobs:
|
|||||||
xml-file: build/extracted-doc/word/document.xml
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- name: Run Demo
|
- name: Run Demo
|
||||||
run: npm run ts-node -- ./demo/73-comments.ts
|
run: npm run run-ts -- ./demo/73-comments.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
# - name: Run Demo
|
||||||
|
# run: npm run run-ts -- ./demo/75-tab-stops.ts
|
||||||
|
# - name: Extract Word Document
|
||||||
|
# run: npm run extract
|
||||||
|
# - name: Validate XML
|
||||||
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
|
# with:
|
||||||
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/76-compatibility.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/77-side-by-side-tables.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/78-thai-distributed.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/79-table-from-data-source.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/80-thai-distributed.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/81-continuous-header.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/82-new-headers-new-section.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/83-setting-languages.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run run-ts -- ./demo/84-positional-tabs.ts
|
||||||
- name: Extract Word Document
|
- name: Extract Word Document
|
||||||
run: npm run extract
|
run: npm run extract
|
||||||
- name: Validate XML
|
- name: Validate XML
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -60,5 +60,5 @@ My Document.docx
|
|||||||
# Temporary folder
|
# Temporary folder
|
||||||
tmp
|
tmp
|
||||||
|
|
||||||
# nyc
|
# Exclude Mac .DS_Store files
|
||||||
.nyc_output
|
.DS_Store
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"diff": true,
|
|
||||||
"spec": "src/**/*.ts",
|
|
||||||
"extension": ["ts"],
|
|
||||||
"package": "./package.json",
|
|
||||||
"reporter": "spec",
|
|
||||||
"slow": "75",
|
|
||||||
"timeout": "2000",
|
|
||||||
"ui": "bdd",
|
|
||||||
"watch-files": ["src/**/*.ts"],
|
|
||||||
"watch-ignore": ["build", "demo"],
|
|
||||||
"require": ["mocha.env", "ts-node/register", "tsconfig-paths/register"]
|
|
||||||
}
|
|
@ -40,4 +40,7 @@ build-tests
|
|||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# docs
|
# docs
|
||||||
docs
|
docs
|
||||||
|
|
||||||
|
# src
|
||||||
|
src
|
||||||
|
25
.nycrc
25
.nycrc
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"check-coverage": true,
|
|
||||||
"statements": 99.79,
|
|
||||||
"branches": 98.41,
|
|
||||||
"functions": 100,
|
|
||||||
"lines": 99.73,
|
|
||||||
"include": [
|
|
||||||
"src/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"src/**/*.spec.ts",
|
|
||||||
"src/import-dotx/import-dotx.ts"
|
|
||||||
],
|
|
||||||
"reporter": [
|
|
||||||
"lcov",
|
|
||||||
"text",
|
|
||||||
"json"
|
|
||||||
],
|
|
||||||
"extension": [
|
|
||||||
".ts"
|
|
||||||
],
|
|
||||||
"cache": true,
|
|
||||||
"all": true,
|
|
||||||
"sourceMap": true
|
|
||||||
}
|
|
4
.vscode/launch.json
vendored
Normal file
4
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": []
|
||||||
|
}
|
20
.vscode/tasks.json
vendored
20
.vscode/tasks.json
vendored
@ -2,23 +2,5 @@
|
|||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
// for the documentation about the tasks.json format
|
// for the documentation about the tasks.json format
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": []
|
||||||
{
|
|
||||||
"type": "typescript",
|
|
||||||
"tsconfig": "tsconfig.json",
|
|
||||||
"option": "watch",
|
|
||||||
"problemMatcher": [
|
|
||||||
"$tsc-watch"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "npm",
|
|
||||||
"script": "ts-node",
|
|
||||||
"problemMatcher": [],
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Easily generate .docx files with JS/TS. Works for Node and on the Browser.
|
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -12,7 +12,6 @@
|
|||||||
[![Downloads per month][downloads-image]][downloads-url]
|
[![Downloads per month][downloads-image]][downloads-url]
|
||||||
[![GitHub Action Workflow Status][github-actions-workflow-image]][github-actions-workflow-url]
|
[![GitHub Action Workflow Status][github-actions-workflow-image]][github-actions-workflow-url]
|
||||||
[![Known Vulnerabilities][snky-image]][snky-url]
|
[![Known Vulnerabilities][snky-image]][snky-url]
|
||||||
[![Chat on Gitter][gitter-image]][gitter-url]
|
|
||||||
[![PRs Welcome][pr-image]][pr-url]
|
[![PRs Welcome][pr-image]][pr-url]
|
||||||
[![codecov][codecov-image]][codecov-url]
|
[![codecov][codecov-image]][codecov-url]
|
||||||
|
|
||||||
@ -88,6 +87,7 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
|
|||||||
[<img src="https://i.imgur.com/cmykN7c.png" alt="drawing"/>](https://www.arity.co/)
|
[<img src="https://i.imgur.com/cmykN7c.png" alt="drawing"/>](https://www.arity.co/)
|
||||||
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
|
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
|
||||||
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
||||||
|
[<img src="https://i.imgur.com/9tqJaHw.png" alt="drawing" height="50"/>](https://novelpad.co/)
|
||||||
|
|
||||||
...and many more!
|
...and many more!
|
||||||
|
|
||||||
@ -106,8 +106,6 @@ Made with 💖
|
|||||||
[github-actions-workflow-url]: https://github.com/dolanmiu/docx/actions
|
[github-actions-workflow-url]: https://github.com/dolanmiu/docx/actions
|
||||||
[snky-image]: https://snyk.io/test/github/dolanmiu/docx/badge.svg
|
[snky-image]: https://snyk.io/test/github/dolanmiu/docx/badge.svg
|
||||||
[snky-url]: https://snyk.io/test/github/dolanmiu/docx
|
[snky-url]: https://snyk.io/test/github/dolanmiu/docx
|
||||||
[gitter-image]: https://badges.gitter.im/dolanmiu/docx.svg
|
|
||||||
[gitter-url]: https://gitter.im/docx-lib/Lobby
|
|
||||||
[pr-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
[pr-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
||||||
[pr-url]: http://makeapullrequest.com
|
[pr-url]: http://makeapullrequest.com
|
||||||
[codecov-image]: https://codecov.io/gh/dolanmiu/docx/branch/master/graph/badge.svg
|
[codecov-image]: https://codecov.io/gh/dolanmiu/docx/branch/master/graph/badge.svg
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Simple example to add text to a document
|
// Simple example to add text to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Generate a CV
|
// Generate a CV
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, Tab, TabStopPosition, TabStopType, TextRun } from "../build";
|
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, Tab, TabStopPosition, TabStopType, TextRun } from "docx";
|
||||||
|
|
||||||
// tslint:disable:no-shadowed-variable
|
// tslint:disable:no-shadowed-variable
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Setting styles with JavaScript configuration
|
// Setting styles with JavaScript configuration
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
AlignmentType,
|
AlignmentType,
|
||||||
@ -16,7 +16,7 @@ import {
|
|||||||
TabStopPosition,
|
TabStopPosition,
|
||||||
UnderlineType,
|
UnderlineType,
|
||||||
LevelFormat,
|
LevelFormat,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Scaling images
|
// Scaling images
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph } from "../build";
|
import { Document, ImageRun, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This example shows 3 styles using XML styles
|
// This example shows 3 styles using XML styles
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Page numbers
|
// Page numbers
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Page break before example
|
// Page break before example
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph } from "../build";
|
import { Document, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Multiple sections and headers
|
// Multiple sections and headers
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Footer, Header, Packer, PageNumber, NumberFormat, PageOrientation, Paragraph, TextRun } from "../build";
|
import { Document, Footer, Header, Packer, PageNumber, NumberFormat, PageOrientation, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Footnotes
|
// Footnotes
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "../build";
|
import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
footnotes: {
|
footnotes: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Insert image from a buffer
|
// Insert image from a buffer
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph } from "../build";
|
import { Document, ImageRun, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8iHx8iHSAiHiAjHiAjHx8jHx8hHx8iHx8iHyAiHiAjHiAjHiAjHh4hHx8iHx8iHx8iHyAjHSAjHiAjHiAjHh4hHx8iHx8iHx8jHyAjHiAhHh4iHx8iHx8jHyAjHSAjHSAhHiAhHh4iHx8iHx8jHx8jHyAjHSAjHSAiHh4iHh4jHx8jHx8jHyAjHyAhHSAhHSAiHh4iHh4jHx8jHx8jHyAhHyAhHSAiHSAiHh4jHh4jHx8jHx8jHyAhHyAhHSAiHSAjHR4jHh4jHx8jHx8hHyAhHyAiHSAjHSAjHR4jHh4jHx8hHx8hHyAhHyAiHyAjHSAjHR4jHR4hHh4hHx8hHyAiHyAjHyAjHSAj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+ohf+z1pP8lQY/GHZQMV4YD3FpXDp4qerqbF/lBWBswyi+AL+ia+maLgcRRQj4IYlY/UpauqKBsPJAxQF8NM1TRQ/RudSPAD34rK3scOuR8/HGcspxsJfOVS8NZbiGXiUtPgINU3v3WFDmx8pEuG3EiqKKVbCC1vm2iZqap5LAtCtleQf8F9sFYWDohzeJczYyQ4V2bEZFGsQgJRGqqqhS2phHTWn9lDkIhBTqWqxQZ+IsRvtdHY9AvI2VX2hW68nfqGmuQsCEl3JdjfCF8OW1bPdtwhQ0gm2mQzfRE3a7KCYj0BNZJs8+Kxf/r6WtTEI2FIqlsMfFgRB5A6KUnSe/vUkX0AnuvUIt8SjM1m6wWQymUwmk8lkMgXRf5vi8rLQxtUhAAAAAElFTkSuQmCC`;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Export to base64 string - Useful in a browser environment.
|
// Export to base64 string - Useful in a browser environment.
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
// Example on how to customize the look at feel using Styles
|
// Example on how to customize the look at feel using Styles
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph, TextRun, UnderlineType } from "docx";
|
||||||
AlignmentType,
|
|
||||||
convertInchesToTwip,
|
|
||||||
Document,
|
|
||||||
HeadingLevel,
|
|
||||||
LevelFormat,
|
|
||||||
Packer,
|
|
||||||
Paragraph,
|
|
||||||
TextRun,
|
|
||||||
UnderlineType,
|
|
||||||
} from "../build";
|
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Clippy",
|
creator: "Clippy",
|
||||||
@ -53,6 +43,15 @@ const doc = new Document({
|
|||||||
color: "#FF0000",
|
color: "#FF0000",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
document: {
|
||||||
|
run: {
|
||||||
|
size: "11pt",
|
||||||
|
font: "Calibri",
|
||||||
|
},
|
||||||
|
paragraph: {
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
paragraphStyles: [
|
paragraphStyles: [
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add custom borders to table cell
|
// Add custom borders to table cell
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { BorderStyle, Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
import { BorderStyle, Document, Packer, Paragraph, Table, TableCell, TableRow } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,18 +1,7 @@
|
|||||||
// This demo shows how to create bookmarks then link to them with internal hyperlinks
|
// This demo shows how to create bookmarks then link to them with internal hyperlinks
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import { Bookmark, Document, Footer, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun, PageReference } from "docx";
|
||||||
Bookmark,
|
|
||||||
Document,
|
|
||||||
Footer,
|
|
||||||
HeadingLevel,
|
|
||||||
InternalHyperlink,
|
|
||||||
Packer,
|
|
||||||
PageBreak,
|
|
||||||
Paragraph,
|
|
||||||
TextRun,
|
|
||||||
PageReference,
|
|
||||||
} from "../build";
|
|
||||||
|
|
||||||
const LOREM_IPSUM =
|
const LOREM_IPSUM =
|
||||||
/* cspell:disable-next-line */
|
/* cspell:disable-next-line */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This demo shows right to left for special languages
|
// This demo shows right to left for special languages
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableCell, TableRow, TextRun } from "../build";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This demo adds an image to the Media cache, and then insert to the document afterwards
|
// This demo adds an image to the Media cache, and then insert to the document afterwards
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph, TextRun } from "../build";
|
import { Document, ImageRun, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8j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ocZROj4JdEikroVkjFk9DcStXxpdfCD2MoXodu4RUU9ptxxmXssOfxnvDVcxRTod9FxyhqLoAqis5aPhwTDp9spRgEH2Q6KLbYoKqlaKTm6Isp0C/sJMnjFvhiERXPQvUNRe9p29lhR04CdBpC8Sl8YiuncIxEuzUUg4Dkgj+paVozygY9plPMh28SaymO9kabAopREGF3vt9MzeFFl8G7lRSZ8FFGK8XX4VA8QjEd7XrM3M0OXz8YCy+qKBLgq3wqnofiTorF0Ax56Rg1J1elW+BBAsVe+My6iYq7IK6keBdOIseV2qn5Pb8f3MqkWAXf9ThM8c8lAOIotuFsF875lRrH5klRcG0+xcPwQ1oLxfeRAP4heQTnGL78X2rqlw2DK59SXAV/zKaiGMAuko5InCt68mcOan5+ohf+z1pP8lQY/GHZQMV4YD3FpXDp4qerqbF/lBWBswyi+AL+ia+maLgcRRQj4IYlY/UpauqKBsPJAxQF8NM1TRQ/RudSPAD34rK3scOuR8/HGcspxsJfOVS8NZbiGXiUtPgINU3v3WFDmx8pEuG3EiqKKVbCC1vm2iZqap5LAtCtleQf8F9sFYWDohzeJczYyQ4V2bEZFGsQgJRGqqqhS2phHTWn9lDkIhBTqWqxQZ+IsRvtdHY9AvI2VX2hW68nfqGmuQsCEl3JdjfCF8OW1bPdtwhQ0gm2mQzfRE3a7KCYj0BNZJs8+Kxf/r6WtTEI2FIqlsMfFgRB5A6KUnSe/vUkX0AnuvUIt8SjM1m6wWQymUwmk8lkMgXRf5vi8rLQxtUhAAAAAElFTkSuQmCC`;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add image to table cell
|
// Add image to table cell
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how you would create a table and add data to it
|
// Example of how you would create a table and add data to it
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "docx";
|
||||||
|
|
||||||
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Creates two paragraphs, one with a border and one without
|
// Creates two paragraphs, one with a border and one without
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { BorderStyle, Document, Packer, Paragraph, TextRun } from "../build";
|
import { BorderStyle, Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -25,6 +25,17 @@ const doc = new Document({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
text: "",
|
||||||
|
border: {
|
||||||
|
top: {
|
||||||
|
color: "auto",
|
||||||
|
space: 1,
|
||||||
|
style: BorderStyle.SINGLE,
|
||||||
|
size: 6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new TextRun({
|
new TextRun({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Custom styles using JavaScript configuration
|
// Custom styles using JavaScript configuration
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, convertInchesToTwip, HeadingLevel, Packer, Paragraph, UnderlineType } from "../build";
|
import { Document, convertInchesToTwip, HeadingLevel, Packer, Paragraph, UnderlineType } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Table of contents
|
// Table of contents
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { File, HeadingLevel, Packer, Paragraph, StyleLevel, TableOfContents } from "../build";
|
import { File, HeadingLevel, Packer, Paragraph, StyleLevel, TableOfContents } from "docx";
|
||||||
|
|
||||||
// WordprocessingML docs for TableOfContents can be found here:
|
// WordprocessingML docs for TableOfContents can be found here:
|
||||||
// http://officeopenxml.com/WPtableOfContents.php
|
// http://officeopenxml.com/WPtableOfContents.php
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// Numbered lists
|
// Numbered lists
|
||||||
// The lists can also be restarted by specifying the instance number
|
// The lists can also be restarted by specifying the instance number
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Numbering and bullet points example
|
// Numbering and bullet points example
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, convertInchesToTwip, Document, Footer, Header, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
import { AlignmentType, convertInchesToTwip, Document, Footer, Header, HeadingLevel, LevelFormat, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// Example on how to use a template document
|
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
|
||||||
import { Document, ImportDotx, Packer, Paragraph } from "../build";
|
|
||||||
|
|
||||||
const importDotx = new ImportDotx();
|
|
||||||
const filePath = "./demo/dotx/template.dotx";
|
|
||||||
|
|
||||||
fs.readFile(filePath, (err, data) => {
|
|
||||||
if (err) {
|
|
||||||
throw new Error(`Failed to read file ${filePath}.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
importDotx.extract(data).then((templateDocument) => {
|
|
||||||
const doc = new Document(
|
|
||||||
{
|
|
||||||
sections: [
|
|
||||||
{
|
|
||||||
properties: {
|
|
||||||
titlePage: templateDocument.titlePageIsDefined,
|
|
||||||
},
|
|
||||||
children: [new Paragraph("Hello World")],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
template: templateDocument,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Packer.toBuffer(doc).then((buffer) => {
|
|
||||||
fs.writeFileSync("My Document.docx", buffer);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how you would create a table and add data to it
|
// Example of how you would create a table and add data to it
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Example of how you would merge cells together (Rows and Columns) and apply shading
|
// Example of how you would merge cells together (Rows and Columns) and apply shading
|
||||||
// Also includes an example on how to center tables
|
// Also includes an example on how to center tables
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
AlignmentType,
|
AlignmentType,
|
||||||
@ -15,7 +15,7 @@ import {
|
|||||||
TableCell,
|
TableCell,
|
||||||
TableRow,
|
TableRow,
|
||||||
WidthType,
|
WidthType,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Sequential Captions
|
// Sequential Captions
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, SequentialIdentifier, TextRun } from "../build";
|
import { Document, Packer, Paragraph, SequentialIdentifier, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Example of how you would create a table with float positions
|
// Example of how you would create a table with float positions
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
Document,
|
Document,
|
||||||
@ -14,7 +14,7 @@ import {
|
|||||||
TableLayoutType,
|
TableLayoutType,
|
||||||
TableRow,
|
TableRow,
|
||||||
WidthType,
|
WidthType,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
// Example on how to add hyperlinks to websites
|
// Example on how to add hyperlinks to websites
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ExternalHyperlink, Footer, FootnoteReferenceRun, ImageRun, Packer, Paragraph, TextRun } from "../build";
|
import { Document, ExternalHyperlink, Footer, FootnoteReferenceRun, ImageRun, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
|
styles: {
|
||||||
|
default: {
|
||||||
|
hyperlink: {
|
||||||
|
run: {
|
||||||
|
color: "FF0000",
|
||||||
|
underline: {
|
||||||
|
color: "0000FF",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
footnotes: {
|
footnotes: {
|
||||||
1: {
|
1: {
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add image to table cell in a header and body
|
// Add image to table cell in a header and body
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Header, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
import { Document, Header, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add images to header and footer
|
// Add images to header and footer
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Header, ImageRun, Packer, Paragraph } from "../build";
|
import { Document, Header, ImageRun, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// Example of how to "wrap" text around an image
|
// Example of how to "wrap" text around an image
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
// import { Document, Packer, Paragraph } from "../build";
|
// import { Document, Packer, Paragraph } from "docx";
|
||||||
import { Document, ImageRun, Packer, Paragraph, TextWrappingSide, TextWrappingType } from "../build";
|
import { Document, ImageRun, Packer, Paragraph, TextWrappingSide, TextWrappingType } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example how to display page numbers
|
// Example how to display page numbers
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how you would create a table and add data to it
|
// Example of how you would create a table and add data to it
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
columnWidths: [3505, 5505],
|
columnWidths: [3505, 5505],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example demonstrating line numbers.
|
// Example demonstrating line numbers.
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "../build";
|
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Multiple cells merging in the same table - Rows and Columns
|
// Multiple cells merging in the same table - Rows and Columns
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow } from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Page numbers - Start from 0 on a new section
|
// Page numbers - Start from 0 on a new section
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, PageNumberSeparator, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, PageNumberSeparator, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add image to table cell
|
// Add image to table cell
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "docx";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh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
|||||||
// Sections with multiple columns
|
// Sections with multiple columns
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph } from "../build";
|
import { Document, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Highlighting text
|
// Highlighting text
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Header, Packer, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Header, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Shading text
|
// Shading text
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Header, Packer, Paragraph, ShadingType, TextRun } from "../build";
|
import { AlignmentType, Document, Header, Packer, Paragraph, ShadingType, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Multiple sections with total number of pages in each section
|
// Multiple sections with total number of pages in each section
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const header = new Header({
|
const header = new Header({
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of making content of section vertically aligned
|
// Example of making content of section vertically aligned
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, VerticalAlign, TextRun, Tab } from "../build";
|
import { Document, Packer, Paragraph, VerticalAlign, TextRun, Tab } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Add custom borders and no-borders to the table itself
|
// Add custom borders and no-borders to the table itself
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
BorderStyle,
|
BorderStyle,
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
TextDirection,
|
TextDirection,
|
||||||
VerticalAlign,
|
VerticalAlign,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Example of how to add images to the document - You can use Buffers, UInt8Arrays or Base64 strings
|
// Example of how to add images to the document - You can use Buffers, UInt8Arrays or Base64 strings
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
Document,
|
Document,
|
||||||
@ -10,7 +10,7 @@ import {
|
|||||||
Paragraph,
|
Paragraph,
|
||||||
VerticalPositionAlign,
|
VerticalPositionAlign,
|
||||||
VerticalPositionRelativeFrom,
|
VerticalPositionRelativeFrom,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// The demo on the README.md
|
// The demo on the README.md
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "../build";
|
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "docx";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Custom character styles using JavaScript configuration
|
// Custom character styles using JavaScript configuration
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun } from "../build";
|
import { Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Japanese text - Need to use a Japanese font
|
// Japanese text - Need to use a Japanese font
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
// Note that if the OS have not install `KaiTi` font, this demo doesn't work.
|
// Note that if the OS have not install `KaiTi` font, this demo doesn't work.
|
||||||
|
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
// to the document in Word after the document has been generated. Standard properties (such as creator, title
|
// to the document in Word after the document has been generated. Standard properties (such as creator, title
|
||||||
// and subject) cover typical use cases, but sometimes custom properties are required.
|
// and subject) cover typical use cases, but sometimes custom properties are required.
|
||||||
|
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer } from "../build";
|
import { Document, Packer } from "docx";
|
||||||
|
|
||||||
const doc = new Document(
|
const doc = new Document(
|
||||||
// Standard properties
|
// Standard properties
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Simple example to add text to a document
|
// Simple example to add text to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
Document,
|
Document,
|
||||||
@ -21,7 +21,7 @@ import {
|
|||||||
Packer,
|
Packer,
|
||||||
Paragraph,
|
Paragraph,
|
||||||
TextRun,
|
TextRun,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Change background colour of whole document
|
// Change background colour of whole document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
background: {
|
background: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Numbered lists - Add parent number in sub number
|
// Numbered lists - Add parent number in sub number
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Usage of different Section Types
|
// Usage of different Section Types
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun, SectionType } from "../build";
|
import { Document, Packer, Paragraph, TextRun, SectionType } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Move + offset header and footer
|
// Move + offset header and footer
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Footer, Header, Packer, Paragraph } from "../build";
|
import { Document, Footer, Header, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how to change page borders
|
// Example of how to change page borders
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph, Tab, TextRun } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph, Tab, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Track Revisions aka. "Track Changes"
|
// Track Revisions aka. "Track Changes"
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
AlignmentType,
|
AlignmentType,
|
||||||
@ -14,7 +14,7 @@ import {
|
|||||||
ShadingType,
|
ShadingType,
|
||||||
Tab,
|
Tab,
|
||||||
TextRun,
|
TextRun,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For reference, see
|
For reference, see
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Text Frame (Text Box) example
|
// Text Frame (Text Box) example
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
BorderStyle,
|
BorderStyle,
|
||||||
@ -11,7 +11,7 @@ import {
|
|||||||
Tab,
|
Tab,
|
||||||
TextRun,
|
TextRun,
|
||||||
VerticalPositionAlign,
|
VerticalPositionAlign,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Simple example to add text to a document
|
// Simple example to add text to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, LineRuleType, Packer, Paragraph, TextRun } from "../build";
|
import { Document, LineRuleType, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Move + offset header and footer
|
// Move + offset header and footer
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Footer, Header, Packer, PageBreak, Paragraph, TextRun } from "../build";
|
import { Document, Footer, Header, Packer, PageBreak, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
evenAndOddHeaderAndFooters: true,
|
evenAndOddHeaderAndFooters: true,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Numbered lists - With complex number text
|
// Numbered lists - With complex number text
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, LevelFormat } from "../build";
|
import { Document, Packer, Paragraph, LevelFormat } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// Example of how to set the document page sizes
|
// Example of how to set the document page sizes
|
||||||
// Reference from https://papersizes.io/a/a3
|
// Reference from https://papersizes.io/a/a3
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { convertMillimetersToTwip, Document, Packer, PageOrientation, Paragraph } from "../build";
|
import { convertMillimetersToTwip, Document, Packer, PageOrientation, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Use fields to include dynamic text
|
// Use fields to include dynamic text
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Bookmark, Document, Packer, Paragraph, SimpleField, TextRun } from "../build";
|
import { Bookmark, Document, Packer, Paragraph, SimpleField, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Me",
|
creator: "Me",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Section with 2 columns including a column break
|
// Section with 2 columns including a column break
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, ColumnBreak, TextRun } from "../build";
|
import { Document, Packer, Paragraph, ColumnBreak, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, LevelFormat } from "../build";
|
import { Document, Packer, Paragraph, LevelFormat } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Sections with multiple columns
|
// Sections with multiple columns
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Column, Document, Packer, Paragraph } from "../build";
|
import { Column, Document, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how to set the document to landscape
|
// Example of how to set the document to landscape
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, PageOrientation, Paragraph } from "../build";
|
import { Document, Packer, PageOrientation, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example demonstrating line numbers with suppression.
|
// Example demonstrating line numbers with suppression.
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "../build";
|
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example demonstrating page borders with style, colors and size
|
// Example demonstrating page borders with style, colors and size
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, TextRun, Paragraph, BorderStyle, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder } from "../build";
|
import { Document, Packer, TextRun, Paragraph, BorderStyle, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example on how to preserve word wrap text. Works with all languages.
|
// Example on how to preserve word wrap text. Works with all languages.
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun, SpaceType } from "../build";
|
import { Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,11 +1,87 @@
|
|||||||
// Simple example to add comments to a document
|
// Simple example to add comments to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun, CommentRangeStart, CommentRangeEnd, CommentReference } from "../build";
|
import { Document, Packer, Paragraph, TextRun, CommentRangeStart, CommentRangeEnd, CommentReference } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
comments: {
|
comments: {
|
||||||
children: [{ id: 0, author: "Ray Chen", date: new Date(), text: "comment text content" }],
|
children: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
author: "Ray Chen",
|
||||||
|
date: new Date(),
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "some initial text content",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "comment text content",
|
||||||
|
}),
|
||||||
|
new TextRun({ text: "", break: 1 }),
|
||||||
|
new TextRun({
|
||||||
|
text: "More text here",
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
author: "Bob Ross",
|
||||||
|
date: new Date(),
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Some initial text content",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "comment text content",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
author: "John Doe",
|
||||||
|
date: new Date(),
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Hello World",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
author: "Beatriz",
|
||||||
|
date: new Date(),
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Another reply",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
@ -26,6 +102,32 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new CommentRangeStart(1),
|
||||||
|
new CommentRangeStart(2),
|
||||||
|
new CommentRangeStart(3),
|
||||||
|
new TextRun({
|
||||||
|
text: "Some text which need commenting",
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
new CommentRangeEnd(1),
|
||||||
|
new TextRun({
|
||||||
|
children: [new CommentReference(1)],
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
new CommentRangeEnd(2),
|
||||||
|
new TextRun({
|
||||||
|
children: [new CommentReference(2)],
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
new CommentRangeEnd(3),
|
||||||
|
new TextRun({
|
||||||
|
children: [new CommentReference(3)],
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Exporting the document as a stream
|
// Exporting the document as a stream
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,23 +1,24 @@
|
|||||||
// Exporting the document as a stream
|
// Example of using tab stops
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph, TabStopPosition, TabStopType, TextRun } from "../build";
|
import { Document, HeadingLevel, Packer, Paragraph, TabStopPosition, TabStopType, TextRun } from "docx";
|
||||||
|
|
||||||
const columnWidth = TabStopPosition.MAX / 4;
|
const columnWidth = TabStopPosition.MAX / 4;
|
||||||
const receiptTabStops = [
|
const receiptTabStops = [
|
||||||
// no need to define first left tab column
|
// no need to define first left tab column
|
||||||
// the right aligned tab column position should point to the end of column
|
// the right aligned tab column position should point to the end of column
|
||||||
// i.e. in this case
|
// i.e. in this case
|
||||||
// (end position of 1st) + (end position of current)
|
// (end position of 1st) + (end position of current)
|
||||||
// columnWidth + columnWidth = columnWidth * 2
|
// columnWidth + columnWidth = columnWidth * 2
|
||||||
|
|
||||||
{ type: TabStopType.RIGHT, position: columnWidth * 2 },
|
{ type: TabStopType.RIGHT, position: columnWidth * 2 },
|
||||||
{ type: TabStopType.RIGHT, position: columnWidth * 3 },
|
{ type: TabStopType.RIGHT, position: columnWidth * 3 },
|
||||||
{ type: TabStopType.RIGHT, position: TabStopPosition.MAX },
|
{ type: TabStopType.RIGHT, position: TabStopPosition.MAX },
|
||||||
],
|
];
|
||||||
twoTabStops = [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }];
|
const twoTabStops = [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }];
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
|
defaultTabStop: 0,
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
properties: {},
|
properties: {},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add compatibility options
|
// Add compatibility options
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun } from "../build";
|
import { Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
compatibility: {
|
compatibility: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Exporting the document as a stream
|
// Exporting the document as a stream
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableBorders, TableCell, TableRow, WidthType } from "../build";
|
import { Document, Packer, Paragraph, Table, TableBorders, TableCell, TableRow, WidthType } from "docx";
|
||||||
|
|
||||||
const table1 = new Table({
|
const table1 = new Table({
|
||||||
columnWidths: [3505, 5505],
|
columnWidths: [3505, 5505],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Simple example to add text to a document
|
// Simple example to add text to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Packer, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Example of how you would create a table and add data to it from a data source
|
// Example of how you would create a table and add data to it from a data source
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
Document,
|
Document,
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
TextDirection,
|
TextDirection,
|
||||||
TextRun,
|
TextRun,
|
||||||
WidthType,
|
WidthType,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
interface StockPrice {
|
interface StockPrice {
|
||||||
readonly date: Date;
|
readonly date: Date;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add text to header and footer
|
// Add text to header and footer
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Footer, Header, Packer, Paragraph } from "../build";
|
import { Document, Footer, Header, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Simple example to add text to a document
|
// Simple example to add text to a document
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, convertMillimetersToTwip, Document, Packer, Paragraph, TextRun } from "../build";
|
import { AlignmentType, convertMillimetersToTwip, Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
148
demo/81-continuous-header.ts
Normal file
148
demo/81-continuous-header.ts
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
// Example of a continuous header
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, Footer, Header, Packer, Paragraph, SectionType, TextRun } from "docx";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
creator: "Creator",
|
||||||
|
title: "Title",
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
properties: { titlePage: true },
|
||||||
|
headers: {
|
||||||
|
first: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "HEADER PAGE ONE",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
default: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "HEADER PAGE TWO AND FOLLOWING PAGES",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
footers: {
|
||||||
|
first: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "FOOTER PAGE ONE",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
default: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "FOOTER PAGE TWO AND FOLLOWING PAGES",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac suscipit orci, in lobortis risus. Nulla vehicula rutrum finibus. Nullam consequat, magna in vehicula commodo, enim massa consectetur nisl, sit amet rutrum nunc ante vel lorem. Sed sit amet scelerisque velit. Proin non quam eget mauris aliquet posuere a sed orci. Proin posuere ante suscipit neque dignissim hendrerit. Pellentesque eget dapibus metus. Donec at mollis mauris. Vestibulum sit amet scelerisque nulla. Vivamus ipsum erat, tempor sed volutpat non, molestie at odio. Vivamus lectus ligula, finibus at mattis vitae, euismod sed tellus. Etiam neque massa, faucibus a fringilla nec, mollis at ex. Aliquam eget nibh tortor. Sed ut viverra libero. Nulla facilisis bibendum quam eget porttitor.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed eget nunc ac turpis facilisis volutpat. Duis eget arcu vitae neque porta hendrerit. Proin vel ante nulla. Duis congue efficitur dui. Suspendisse potenti. Aliquam aliquam nibh eu ipsum sagittis efficitur. Quisque sagittis metus dui, vitae suscipit tortor sollicitudin at. Suspendisse convallis, sem ac ornare condimentum, odio ipsum dapibus justo, a aliquam risus massa ut enim. Mauris vel placerat nibh. Ut iaculis vitae nibh at elementum. Quisque hendrerit et magna vitae mollis. Duis dictum euismod leo, at cursus risus sodales sed.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
spacing: {
|
||||||
|
after: 500,
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "The first section ends after this paragraph.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
properties: {
|
||||||
|
type: SectionType.CONTINUOUS,
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac suscipit orci, in lobortis risus. Nulla vehicula rutrum finibus. Nullam consequat, magna in vehicula commodo, enim massa consectetur nisl, sit amet rutrum nunc ante vel lorem. Sed sit amet scelerisque velit. Proin non quam eget mauris aliquet posuere a sed orci. Proin posuere ante suscipit neque dignissim hendrerit. Pellentesque eget dapibus metus. Donec at mollis mauris. Vestibulum sit amet scelerisque nulla. Vivamus ipsum erat, tempor sed volutpat non, molestie at odio. Vivamus lectus ligula, finibus at mattis vitae, euismod sed tellus. Etiam neque massa, faucibus a fringilla nec, mollis at ex. Aliquam eget nibh tortor. Sed ut viverra libero. Nulla facilisis bibendum quam eget porttitor.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed eget nunc ac turpis facilisis volutpat. Duis eget arcu vitae neque porta hendrerit. Proin vel ante nulla. Duis congue efficitur dui. Suspendisse potenti. Aliquam aliquam nibh eu ipsum sagittis efficitur. Quisque sagittis metus dui, vitae suscipit tortor sollicitudin at. Suspendisse convallis, sem ac ornare condimentum, odio ipsum dapibus justo, a aliquam risus massa ut enim. Mauris vel placerat nibh. Ut iaculis vitae nibh at elementum. Quisque hendrerit et magna vitae mollis. Duis dictum euismod leo, at cursus risus sodales sed.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "The second section starts with the headline above. Move cursor to the end of this text and press enter until next page is generated in continuous section break mode.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
148
demo/82-new-headers-new-section.ts
Normal file
148
demo/82-new-headers-new-section.ts
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
// Example of using headers and footers in a new section
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, Footer, Header, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
creator: "Creator",
|
||||||
|
title: "Title",
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
default: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "HEADER PAGE ONE",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
footers: {
|
||||||
|
default: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "FOOTER PAGE ONE",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac suscipit orci, in lobortis risus. Nulla vehicula rutrum finibus. Nullam consequat, magna in vehicula commodo, enim massa consectetur nisl, sit amet rutrum nunc ante vel lorem. Sed sit amet scelerisque velit. Proin non quam eget mauris aliquet posuere a sed orci. Proin posuere ante suscipit neque dignissim hendrerit. Pellentesque eget dapibus metus. Donec at mollis mauris. Vestibulum sit amet scelerisque nulla. Vivamus ipsum erat, tempor sed volutpat non, molestie at odio. Vivamus lectus ligula, finibus at mattis vitae, euismod sed tellus. Etiam neque massa, faucibus a fringilla nec, mollis at ex. Aliquam eget nibh tortor. Sed ut viverra libero. Nulla facilisis bibendum quam eget porttitor.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed eget nunc ac turpis facilisis volutpat. Duis eget arcu vitae neque porta hendrerit. Proin vel ante nulla. Duis congue efficitur dui. Suspendisse potenti. Aliquam aliquam nibh eu ipsum sagittis efficitur. Quisque sagittis metus dui, vitae suscipit tortor sollicitudin at. Suspendisse convallis, sem ac ornare condimentum, odio ipsum dapibus justo, a aliquam risus massa ut enim. Mauris vel placerat nibh. Ut iaculis vitae nibh at elementum. Quisque hendrerit et magna vitae mollis. Duis dictum euismod leo, at cursus risus sodales sed.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
spacing: {
|
||||||
|
after: 500,
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "The first section ends after this paragraph.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
default: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "HEADER PAGE TWO AND FOLLOWING PAGES",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
footers: {
|
||||||
|
default: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "FOOTER PAGE TWO AND FOLLOWING PAGES",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac suscipit orci, in lobortis risus. Nulla vehicula rutrum finibus. Nullam consequat, magna in vehicula commodo, enim massa consectetur nisl, sit amet rutrum nunc ante vel lorem. Sed sit amet scelerisque velit. Proin non quam eget mauris aliquet posuere a sed orci. Proin posuere ante suscipit neque dignissim hendrerit. Pellentesque eget dapibus metus. Donec at mollis mauris. Vestibulum sit amet scelerisque nulla. Vivamus ipsum erat, tempor sed volutpat non, molestie at odio. Vivamus lectus ligula, finibus at mattis vitae, euismod sed tellus. Etiam neque massa, faucibus a fringilla nec, mollis at ex. Aliquam eget nibh tortor. Sed ut viverra libero. Nulla facilisis bibendum quam eget porttitor.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed eget nunc ac turpis facilisis volutpat. Duis eget arcu vitae neque porta hendrerit. Proin vel ante nulla. Duis congue efficitur dui. Suspendisse potenti. Aliquam aliquam nibh eu ipsum sagittis efficitur. Quisque sagittis metus dui, vitae suscipit tortor sollicitudin at. Suspendisse convallis, sem ac ornare condimentum, odio ipsum dapibus justo, a aliquam risus massa ut enim. Mauris vel placerat nibh. Ut iaculis vitae nibh at elementum. Quisque hendrerit et magna vitae mollis. Duis dictum euismod leo, at cursus risus sodales sed.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Sed gravida commodo felis, at aliquet risus volutpat ut. Nam nec ex eleifend tellus sodales volutpat nec ac nibh. Vestibulum pretium, leo vitae lobortis accumsan, urna libero euismod ante, consequat aliquam enim risus id nisl. Donec sagittis, justo eu luctus posuere, leo purus pellentesque turpis, eget volutpat mi leo vitae lacus. Etiam ante ante, posuere at augue non, lacinia ornare purus. Praesent vitae velit in enim congue maximus. Vivamus tincidunt fringilla neque. Curabitur fermentum justo nec sapien porttitor, ac ullamcorper nisi imperdiet. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed non orci vel eros egestas eleifend sit amet a diam. Duis mattis at ligula quis faucibus. Donec elementum lacus velit, a vehicula nunc gravida a. Phasellus eget nunc vehicula, varius velit a, maximus velit. Sed a suscipit nisi, non hendrerit felis. Proin mattis facilisis massa, quis elementum neque fringilla non.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "The second section starts with the headline above. Move cursor to the end of this text and press enter until next page is generated in continuous section break mode.",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
69
demo/83-setting-languages.ts
Normal file
69
demo/83-setting-languages.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// Simple example to add text to a document
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
styles: {
|
||||||
|
default: {
|
||||||
|
document: {
|
||||||
|
run: {
|
||||||
|
color: "ff0000",
|
||||||
|
language: {
|
||||||
|
value: "es-ES",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
paragraphStyles: [
|
||||||
|
{
|
||||||
|
id: "frenchNormal",
|
||||||
|
name: "French Normal",
|
||||||
|
basedOn: "Normal",
|
||||||
|
next: "Normal",
|
||||||
|
run: {
|
||||||
|
color: "999999",
|
||||||
|
italics: true,
|
||||||
|
language: {
|
||||||
|
value: "fr-FR",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "koreanNormal",
|
||||||
|
name: "Korean Normal",
|
||||||
|
basedOn: "Normal",
|
||||||
|
next: "Normal",
|
||||||
|
run: {
|
||||||
|
color: "0000ff",
|
||||||
|
bold: true,
|
||||||
|
language: {
|
||||||
|
value: "ko-KR",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
properties: {},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
text: "Yo vivo en Granada, una ciudad pequeña que tiene monumentos muy importantes como la Alhambra. Aquí la comida es deliciosa y son famosos el gazpacho, el rebujito y el salmorejo.",
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
text: "Toute personne a droit à l'éducation. L'éducation doit être gratuite, au moins en ce qui concerne l'enseignement élémentaire et fondamental. L'enseignement élémentaire est obligatoire. L'enseignement technique et professionnel doit être généralisé; l'accès aux études supérieures doit être ouvert en pleine égalité à tous en fonction de leur mérite.",
|
||||||
|
style: "frenchNormal",
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
text: "대법관은 대법원장의 제청으로 국회의 동의를 얻어 대통령이 임명한다. 강화조약. 국가는 국민 모두의 생산 및 생활의 기반이 되는 국토의 효율적이고 균형있는 이용·개발과 보전을 위하여 법률이 정하는 바에 의하여 그에 관한 필요한 제한과 의무를 과할 수 있다, 국가는 청원에 대하여 심사할 의무를 진다.",
|
||||||
|
style: "koreanNormal",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
59
demo/84-positional-tabs.ts
Normal file
59
demo/84-positional-tabs.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// Simple example apply positional tabs to a document
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import {
|
||||||
|
Document,
|
||||||
|
Packer,
|
||||||
|
Paragraph,
|
||||||
|
PositionalTab,
|
||||||
|
TextRun,
|
||||||
|
PositionalTabAlignment,
|
||||||
|
PositionalTabRelativeTo,
|
||||||
|
PositionalTabLeader,
|
||||||
|
} from "docx";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
properties: {},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun("Full name"),
|
||||||
|
new TextRun({
|
||||||
|
children: [
|
||||||
|
new PositionalTab({
|
||||||
|
alignment: PositionalTabAlignment.RIGHT,
|
||||||
|
relativeTo: PositionalTabRelativeTo.MARGIN,
|
||||||
|
leader: PositionalTabLeader.DOT,
|
||||||
|
}),
|
||||||
|
"John Doe",
|
||||||
|
],
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun("Hello World"),
|
||||||
|
new TextRun({
|
||||||
|
children: [
|
||||||
|
new PositionalTab({
|
||||||
|
alignment: PositionalTabAlignment.CENTER,
|
||||||
|
relativeTo: PositionalTabRelativeTo.INDENT,
|
||||||
|
leader: PositionalTabLeader.HYPHEN,
|
||||||
|
}),
|
||||||
|
"Foo bar",
|
||||||
|
],
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
155
demo/85-template-document.ts
Normal file
155
demo/85-template-document.ts
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
// Patch a document with patches
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import {
|
||||||
|
ExternalHyperlink,
|
||||||
|
HeadingLevel,
|
||||||
|
ImageRun,
|
||||||
|
Paragraph,
|
||||||
|
patchDocument,
|
||||||
|
PatchType,
|
||||||
|
Table,
|
||||||
|
TableCell,
|
||||||
|
TableRow,
|
||||||
|
TextDirection,
|
||||||
|
TextRun,
|
||||||
|
VerticalAlign,
|
||||||
|
} from "docx";
|
||||||
|
|
||||||
|
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||||
|
patches: {
|
||||||
|
name: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new TextRun("Sir. "), new TextRun("John Doe"), new TextRun("(The Conqueror)")],
|
||||||
|
},
|
||||||
|
table_heading_1: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new TextRun("Heading wow!")],
|
||||||
|
},
|
||||||
|
item_1: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [
|
||||||
|
new TextRun("#657"),
|
||||||
|
new ExternalHyperlink({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "BBC News Link",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
link: "https://www.bbc.co.uk/news",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
paragraph_replace: {
|
||||||
|
type: PatchType.DOCUMENT,
|
||||||
|
children: [
|
||||||
|
new Paragraph("Lorem ipsum paragraph"),
|
||||||
|
new Paragraph("Another paragraph"),
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun("This is a "),
|
||||||
|
new ExternalHyperlink({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "Google Link",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
link: "https://www.google.co.uk",
|
||||||
|
}),
|
||||||
|
new ImageRun({ data: fs.readFileSync("./demo/images/dog.png"), transformation: { width: 100, height: 100 } }),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
header_adjective: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new TextRun("Delightful Header")],
|
||||||
|
},
|
||||||
|
footer_text: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [
|
||||||
|
new TextRun("replaced just as"),
|
||||||
|
new TextRun(" well"),
|
||||||
|
new ExternalHyperlink({
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
text: "BBC News Link",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
link: "https://www.bbc.co.uk/news",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
image_test: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new ImageRun({ data: fs.readFileSync("./demo/images/image1.jpeg"), transformation: { width: 100, height: 100 } })],
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
type: PatchType.DOCUMENT,
|
||||||
|
children: [
|
||||||
|
new Table({
|
||||||
|
rows: [
|
||||||
|
new TableRow({
|
||||||
|
children: [
|
||||||
|
new TableCell({
|
||||||
|
children: [new Paragraph({}), new Paragraph({})],
|
||||||
|
verticalAlign: VerticalAlign.CENTER,
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [new Paragraph({}), new Paragraph({})],
|
||||||
|
verticalAlign: VerticalAlign.CENTER,
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})],
|
||||||
|
textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT,
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [new Paragraph({ text: "top to bottom" }), new Paragraph({})],
|
||||||
|
textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new TableRow({
|
||||||
|
children: [
|
||||||
|
new TableCell({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
text: "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
|
||||||
|
heading: HeadingLevel.HEADING_1,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
text: "This text should be in the middle of the cell",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
verticalAlign: VerticalAlign.CENTER,
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
text: "Text above should be vertical from bottom to top",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
verticalAlign: VerticalAlign.CENTER,
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
text: "Text above should be vertical from top to bottom",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
verticalAlign: VerticalAlign.CENTER,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).then((doc) => {
|
||||||
|
fs.writeFileSync("My Document.docx", doc);
|
||||||
|
});
|
20
demo/86-generate-template.ts
Normal file
20
demo/86-generate-template.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Generate a template document
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [new TextRun("{{template}}")],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
15
demo/87-template-document.ts
Normal file
15
demo/87-template-document.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Patch a document with patches
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { patchDocument, PatchType, TextRun } from "docx";
|
||||||
|
|
||||||
|
patchDocument(fs.readFileSync("demo/assets/simple-template-2.docx"), {
|
||||||
|
patches: {
|
||||||
|
name: {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new TextRun("Max")],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).then((doc) => {
|
||||||
|
fs.writeFileSync("My Document.docx", doc);
|
||||||
|
});
|
31
demo/88-template-document.ts
Normal file
31
demo/88-template-document.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Patch a document with patches
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { IPatch, patchDocument, PatchType, TextRun } from "docx";
|
||||||
|
|
||||||
|
export const font = "Trebuchet MS";
|
||||||
|
export const getPatches = (fields: { [key: string]: string }) => {
|
||||||
|
const patches: { [key: string]: IPatch } = {};
|
||||||
|
|
||||||
|
for (const field in fields) {
|
||||||
|
patches[field] = {
|
||||||
|
type: PatchType.PARAGRAPH,
|
||||||
|
children: [new TextRun({ text: fields[field], font })],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return patches;
|
||||||
|
};
|
||||||
|
|
||||||
|
const patches = getPatches({
|
||||||
|
name: "Mr",
|
||||||
|
table_heading_1: "John",
|
||||||
|
item_1: "Doe",
|
||||||
|
paragraph_replace: "Lorem ipsum paragraph",
|
||||||
|
});
|
||||||
|
|
||||||
|
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||||
|
patches,
|
||||||
|
}).then((doc) => {
|
||||||
|
fs.writeFileSync("My Document.docx", doc);
|
||||||
|
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user