Compare commits
229 Commits
8.0.3
...
feature/im
Author | SHA1 | Date | |
---|---|---|---|
7d53e5d5f2 | |||
d23f453d28 | |||
6c28f8bab0 | |||
10b87b5a70 | |||
6b6f9d7ed4 | |||
0434d00ff7 | |||
7e3acc25b9 | |||
62ad8f12b7 | |||
a6a656f1a0 | |||
1bf36009e8 | |||
86bdf3e199 | |||
a3c796aae3 | |||
dbe0586f70 | |||
7e2538dffc | |||
c3080ff9d9 | |||
772fc8462a | |||
e194780cd1 | |||
5b80ea32d7 | |||
31b7e07ab3 | |||
939d418af1 | |||
4258dd2a2e | |||
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 | |||
5e14bc6c2a |
25
.cspell.json
25
.cspell.json
@ -4,13 +4,7 @@
|
|||||||
"version": "0.2",
|
"version": "0.2",
|
||||||
// language - current active spelling language
|
// language - current active spelling language
|
||||||
"language": "en_US",
|
"language": "en_US",
|
||||||
"dictionaries": [
|
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
||||||
"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": [
|
||||||
"Abjad",
|
"Abjad",
|
||||||
@ -21,13 +15,18 @@
|
|||||||
"datas",
|
"datas",
|
||||||
"docsify",
|
"docsify",
|
||||||
"dolan",
|
"dolan",
|
||||||
|
"execa",
|
||||||
"falsey",
|
"falsey",
|
||||||
|
"horz",
|
||||||
|
"iife",
|
||||||
"Initializable",
|
"Initializable",
|
||||||
"iroha",
|
"iroha",
|
||||||
"jsonify",
|
"jsonify",
|
||||||
"jszip",
|
"jszip",
|
||||||
"NUMPAGES",
|
"NUMPAGES",
|
||||||
"odttf",
|
"odttf",
|
||||||
|
"ondata",
|
||||||
|
"onfile",
|
||||||
"ooxml",
|
"ooxml",
|
||||||
"panose",
|
"panose",
|
||||||
"rels",
|
"rels",
|
||||||
@ -55,17 +54,13 @@
|
|||||||
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
||||||
"/new [a-zA-Z]+\\({[^£]+}\\)/g",
|
"/new [a-zA-Z]+\\({[^£]+}\\)/g",
|
||||||
"/<element name=\"[a-z]+\"/gi",
|
"/<element name=\"[a-z]+\"/gi",
|
||||||
"/<attribute name=\"[a-z]+\"/gi"
|
"/<attribute name=\"[a-z]+\"/gi",
|
||||||
],
|
"/key: \".+\"/"
|
||||||
"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.
|
||||||
// For example "hte" should be "the"
|
// For example "hte" should be "the"
|
||||||
"flagWords": [
|
"flagWords": ["hte"]
|
||||||
"hte"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
272
.eslintrc.js
272
.eslintrc.js
@ -1,272 +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: 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",
|
|
||||||
"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-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",
|
|
||||||
{
|
|
||||||
assumeTypes: true,
|
|
||||||
ignoreImmediateMutation: true,
|
|
||||||
ignoreAccessorPattern: ["**.root*", "**.numberingReferences*", "**.sections*", "**.properties*"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"functional/prefer-property-signatures": "error",
|
|
||||||
"functional/no-mixed-types": "error",
|
|
||||||
// TODO: Deprecated. Use prefer-immutable-types and type-declaration-immutability instead
|
|
||||||
"functional/prefer-readonly-type": "error",
|
|
||||||
// "functional/prefer-immutable-types": "error",
|
|
||||||
// "functional/type-declaration-immutability": "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",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
238
.eslintrc.yml
Normal file
238
.eslintrc.yml
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
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
|
||||||
|
- UPPER_CASE # for constants
|
||||||
|
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"
|
12
.github/actions/install-and-build/action.yml
vendored
Normal file
12
.github/actions/install-and-build/action.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
name: Install dependencies and build ⚙️
|
||||||
|
description: Install dependencies and build
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Install Dependencies
|
||||||
|
shell: bash
|
||||||
|
run: npm ci --force
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
|
run: npm run build
|
14
.github/actions/validate-docx/action.yml
vendored
Normal file
14
.github/actions/validate-docx/action.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
name: Extract and Validate Document ⚙️
|
||||||
|
description: Extract the document and validate the XML against the schema.
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Extract Word Document
|
||||||
|
shell: bash
|
||||||
|
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
|
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
|
|
||||||
|
9
.github/workflows/default.yml
vendored
9
.github/workflows/default.yml
vendored
@ -14,10 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- uses: "./.github/actions/install-and-build"
|
||||||
run: npm ci --force
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
- name: Archive Production Artifact
|
- name: Archive Production Artifact
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
@ -32,7 +29,7 @@ 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@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
@ -57,7 +54,7 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Prettier
|
- name: Prettier
|
||||||
run: npm run style
|
run: npm run prettier
|
||||||
cspell:
|
cspell:
|
||||||
name: CSpell
|
name: CSpell
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
1505
.github/workflows/demos.yml
vendored
1505
.github/workflows/demos.yml
vendored
File diff suppressed because it is too large
Load Diff
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"]
|
|
||||||
}
|
|
25
.nycrc
25
.nycrc
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"check-coverage": true,
|
|
||||||
"statements": 99.87,
|
|
||||||
"branches": 98.21,
|
|
||||||
"functions": 100,
|
|
||||||
"lines": 99.86,
|
|
||||||
"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
|
|
||||||
}
|
|
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@ -1,18 +1,4 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": []
|
||||||
{
|
|
||||||
"name": "Run Demo",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"runtimeArgs": [
|
|
||||||
"-r",
|
|
||||||
"${workspaceFolder}/node_modules/ts-node/register",
|
|
||||||
"-r",
|
|
||||||
"${workspaceFolder}/node_modules/tsconfig-paths/register"
|
|
||||||
],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"program": "${workspaceFolder}/demo/85-template-document.ts"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
@ -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]
|
||||||
|
|
||||||
@ -107,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,143 @@
|
|||||||
// 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";
|
||||||
|
|
||||||
|
// cspell: disable
|
||||||
|
const createLoremIpsumParagraphs = () => [
|
||||||
|
new Paragraph(
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam accumsan condimentum elit ut placerat. Integer vitae justo est. Quisque tempus augue eu diam pulvinar aliquam. Pellentesque neque sem, posuere eget augue pretium, feugiat mattis diam. Mauris libero arcu, elementum sit amet nunc sed, vestibulum posuere sapien. Nullam",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"ultrices efficitur magna et commodo. Morbi vitae dolor vulputate, dapibus ipsum in, finibus enim. Aliquam dapibus tellus libero. Nullam nulla eros, ullamcorper eu risus at, luctus aliquet nunc. Nunc dictum turpis eu quam suscipit porta. In rutrum scelerisque nunc in consectetur. Pellentesque ut nibh eget neque congue auctor. Nunc dapibus massa elit, vel cursus metus condimentum et. Nunc venenatis dolor eu lobortis fringilla. Nulla sed risus id lectus scelerisque sollicitudin. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Nulla lobortis et purus convallis ullamcorper. Nunc scelerisque, urna eu vestibulum feugiat, orci turpis pulvinar odio, vitae faucibus elit tortor et urna. Curabitur eros mauris, mollis a vestibulum nec, vestibulum sed velit. Nam semper metus ut felis ultricies rutrum. Cras hendrerit eros vel placerat vulputate. Proin placerat ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"mollis lacus a ultricies. Mauris vel turpis vitae purus suscipit dignissim. Donec egestas molestie libero in suscipit. Aenean auctor tellus convallis eros porttitor, id vehicula risus commodo. Sed accumsan turpis elit, eget molestie tortor efficitur eget. Aliquam ut lectus quis augue pellentesque tincidunt id id quam. Maecenas auctor, lorem eu ornare tempor, lacus metus ultrices turpis, nec feugiat nibh purus id justo.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Sed semper feugiat ante, sit amet accumsan lorem vulputate vel. Morbi interdum, mauris sit amet efficitur mattis, nunc sapien tempor ante, eget maximus ipsum arcu quis dolor. Suspendisse id consequat justo, quis sollicitudin nisi. Duis euismod, velit non faucibus placerat, eros sem fermentum lectus, ut egestas nisi ipsum eget mi. ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"Donec vitae mollis libero. Etiam magna leo, auctor sit amet nibh sit amet, interdum finibus nunc. Quisque a pellentesque velit, a laoreet ante.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Quisque fringilla orci quis dui facilisis, quis auctor urna cursus. Mauris eget justo lacus. Integer placerat, leo vitae ullamcorper varius, nulla mauris gravida massa, ac dignissim odio erat eu ante. Duis non dui semper, eleifend neque nec, ultricies ligula. Sed nec sem nec dolor ultrices finibus. Praesent rutrum iaculis mollis. ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"Fusce accumsan dui tortor, quis feugiat urna efficitur sed. Fusce viverra tristique lacinia. Sed nec faucibus ipsum, vel pulvinar ligula. Curabitur ut viverra nisl. Nulla nisi tortor, imperdiet et ipsum sit amet, egestas lacinia leo. Quisque interdum mauris non nunc egestas tempor a vehicula diam. Vestibulum convallis quam sit amet tincidunt posuere. Mauris velit sem, fermentum a diam sit amet, pulvinar iaculis lectus. In dolor turpis, cursus id libero sit amet, aliquet ullamcorper urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Etiam tincidunt euismod nisi, ut dignissim neque blandit sit amet. Etiam vel velit rhoncus, tincidunt diam quis, dignissim felis. Integer dolor urna, rutrum vitae ultricies ut, sagittis quis felis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec pharetra aliquam augue. Donec ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"imperdiet placerat augue, nec consequat leo placerat a. Mauris accumsan ornare massa vitae volutpat. Sed commodo purus ac fringilla ultricies. Donec quis urna hendrerit dolor efficitur sollicitudin. Pellentesque diam arcu, dapibus a nisl pretium, auctor lobortis augue.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Aliquam libero lorem, scelerisque a volutpat ac, venenatis eu nisl. Maecenas turpis diam, consequat eget elementum eget, venenatis at lacus. In maximus erat magna, ut hendrerit erat malesuada vel. Suspendisse iaculis, lacus posuere convallis gravida, nisi purus blandit nunc, imperdiet tempor nunc turpis et sapien. Duis euismod id ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"ligula ac laoreet. Ut facilisis massa quis turpis imperdiet, eu ornare lorem placerat. Vestibulum pharetra feugiat eleifend. Quisque ornare pretium urna, lacinia aliquam eros placerat et. Integer sit amet auctor ipsum. Morbi imperdiet dictum ex sed lacinia. Curabitur interdum mattis nunc non vestibulum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque odio libero, viverra ac quam eleifend, dignissim euismod nibh. Etiam sit amet semper ante. Morbi in tellus lacinia, bibendum dolor quis, viverra nisi. Proin condimentum purus ipsum, et accumsan sapien finibus ac.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Maecenas congue in leo id faucibus. Etiam porta dapibus ultricies. Nunc ac volutpat magna. Nam pretium dolor ac ultrices tincidunt. Vestibulum pharetra elit vitae lacus pharetra euismod. Pellentesque fringilla lacus ac neque varius sagittis. Mauris tincidunt rutrum velit. Etiam pretium est vitae lacus ultricies, vitae viverra ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"turpis auctor. Nulla at lectus pellentesque enim dapibus aliquet eleifend et quam. Suspendisse cursus sed velit et lobortis. Integer sed facilisis ligula, ultrices molestie neque. Nulla porta mauris vitae quam consequat, eget fringilla enim luctus. Integer vitae rhoncus nibh, ac ornare ligula. Sed sed placerat libero. Suspendisse laoreet erat lacus, et lacinia nibh maximus in. Maecenas vitae enim at urna gravida euismod.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam lacinia lobortis tortor mollis venenatis. Sed sodales iaculis justo in rhoncus. Proin orci sapien, fermentum nec eleifend in, tristique vel mi. Donec vitae ornare justo, sed rhoncus nibh. Quisque a interdum est, in scelerisque odio. Ut luctus eget ex non ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"fringilla. Morbi nec iaculis nisi. Donec porta libero ac ex sollicitudin, vitae interdum erat faucibus. Donec ornare, arcu ullamcorper pretium euismod, nibh nisi consectetur justo, ac aliquet sem eros non nibh. Nulla vitae elementum arcu. Aenean ut consectetur dui. Donec posuere condimentum velit ac hendrerit. Sed aliquet aliquet mi, sed rutrum justo ultrices eget.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Donec volutpat libero dui, ac bibendum nunc eleifend a. Fusce ultricies ligula non sollicitudin lobortis. Integer sit amet elit sapien. Morbi rhoncus bibendum nibh et facilisis. Etiam consectetur elementum sem non elementum. Nunc rutrum sagittis ipsum non sodales. Orci varius natoque penatibus et magnis dis parturient montes, ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"nascetur ridiculus mus. Quisque porttitor nulla ultrices mollis porta. Cras non metus sed quam rutrum ultricies. Curabitur aliquet in sem eget auctor. Ut sodales quis leo bibendum venenatis. Etiam pellentesque eros ut metus dignissim commodo. Aliquam vitae sem gravida, convallis ipsum at, imperdiet tellus. Pellentesque consectetur odio sit amet sapien vestibulum aliquam nec id libero. Proin a maximus felis. Aenean molestie vulputate massa, eu eleifend sem consequat id.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Etiam quis ante nec leo faucibus dignissim eu at mi. Nam nec ligula nec sapien rhoncus faucibus. Fusce vestibulum orci libero, vel commodo est congue iaculis. In hac habitasse platea dictumst. Sed lacinia magna eu arcu commodo pretium. Fusce id elementum enim. Mauris tristique tortor dolor, at pretium magna tempor nec. Vivamus non ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"dui sit amet odio porttitor tincidunt. Nam pulvinar aliquet tortor tristique tempor. Duis finibus tincidunt elit, at viverra justo sagittis in. Morbi pellentesque gravida mi, in pulvinar metus molestie at. Fusce bibendum eleifend sapien a fermentum. Nam efficitur tellus dignissim, vehicula tortor ac, tristique enim. Aliquam pretium dui interdum varius elementum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a finibus elit.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Phasellus cursus tortor at justo bibendum aliquam. Sed nec hendrerit nibh, eu finibus tortor. Aenean sit amet dui rutrum, sollicitudin justo eu, condimentum ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas dictum neque lacus, vel posuere eros pretium nec. Morbi ac ante at ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"ex semper ultricies ac quis augue. In hac habitasse platea dictumst. Mauris laoreet porta nisl. Sed augue lorem, aliquet in volutpat ut, rhoncus eget nibh. Sed rhoncus arcu diam, accumsan rhoncus sem iaculis ac. Duis dolor magna, semper et tellus non, condimentum volutpat nisi. Donec eget metus eget elit eleifend vestibulum et ut purus.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Nam a dui accumsan, efficitur ex at, commodo eros. Pellentesque sit amet nunc ac odio egestas suscipit id sodales ligula. Duis non mi vitae mi mollis fringilla at sit amet sem. Morbi laoreet mattis dolor sit amet tincidunt. Aliquam erat volutpat. Pellentesque porta sem odio, at lobortis quam commodo vitae. Curabitur ut urna dolor.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Nulla vitae pretium ex. Nulla facilisi. Vestibulum placerat odio eget enim ultrices, et imperdiet tellus consequat. Sed dignissim, erat ut dignissim interdum, dui mi rhoncus nunc, id rhoncus turpis nunc eu risus. Mauris leo orci, euismod sit amet velit ac, condimentum dictum dui. Cras cursus dolor augue, et vestibulum lorem ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"fringilla in. Nulla fermentum odio vehicula justo placerat, et aliquet velit vulputate. Sed aliquam auctor dictum. Phasellus sit amet sollicitudin elit. Cras eget gravida ex. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis tortor erat, ornare id feugiat eget, pellentesque at lectus. Sed vitae nisi ullamcorper, tincidunt augue vitae, accumsan ligula. Curabitur ut lobortis lacus, imperdiet placerat arcu.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Sed vestibulum tempor nulla vel dignissim. Phasellus imperdiet, dolor nec mollis tempor, nulla nibh pretium nibh, nec elementum lacus neque in sapien. Nam et eleifend lorem. Nam pretium molestie enim quis porta. Proin eu pharetra enim. Etiam a velit eget augue congue tempor. Interdum et malesuada fames ac ante ipsum primis in ",
|
||||||
|
),
|
||||||
|
new Paragraph("faucibus. Sed urna tellus, euismod ac pharetra nec, ultrices vel nisi."),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Phasellus at arcu eget tellus mattis ultricies non quis urna. Vestibulum non eros fringilla, porttitor massa id, ornare metus. Quisque lacinia, massa a ornare vulputate, ex lectus ullamcorper ligula, eget facilisis mi turpis at dolor. Curabitur posuere elementum enim, non placerat tortor tincidunt sit amet. Pellentesque habitant ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nam fermentum ut felis et dapibus. Ut consectetur finibus bibendum. Phasellus semper sapien neque, nec consequat nibh convallis et. Nunc nec egestas enim. Nulla facilisi.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Quisque sed nibh sed lorem placerat ornare sed nec sapien. Morbi et risus vitae magna varius varius eget at leo. Curabitur a eleifend elit. Mauris augue nulla, convallis vel ante in, consequat feugiat orci. Donec sagittis risus nibh, eget porta purus faucibus non. Curabitur ultrices, ex et placerat rutrum, velit odio accumsan ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"nulla, et elementum mi leo in velit. Pellentesque auctor egestas ultricies. In viverra est a mauris sollicitudin, a laoreet augue cursus. Vestibulum non sollicitudin massa. Curabitur ac tellus metus. Pellentesque hendrerit dolor sed mi vestibulum imperdiet. Nulla vitae odio ultrices, tempor enim sed, vestibulum eros. Cras libero ex, malesuada nec porttitor sit amet, efficitur sit amet ligula.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Morbi pellentesque tempus felis, id iaculis quam euismod non. Sed scelerisque id massa eu elementum. Vestibulum id malesuada arcu. Maecenas eget placerat sem, at consectetur orci. Nullam interdum erat urna, ac rhoncus odio feugiat sed. Morbi rutrum auctor sem eget pulvinar. Suspendisse egestas tempor volutpat.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Vivamus euismod, sem eget molestie rhoncus, metus dui laoreet lacus, et lobortis est metus ut felis. Aenean imperdiet lacus nunc, vitae molestie orci ultrices nec. Cras egestas maximus diam, vitae efficitur nisl luctus imperdiet. Nulla pellentesque sodales ante, nec facilisis turpis. Vivamus at hendrerit enim, ac dictum lorem. Cras ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"congue accumsan dui, non pretium sem auctor quis. Nunc a mauris vehicula, elementum ex vitae, sollicitudin eros. Nunc non sapien vitae justo sodales condimentum. Praesent nisl felis, tristique ac odio at, rhoncus porttitor orci. Morbi egestas placerat iaculis.",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In at lorem nec neque faucibus ultricies ut in ipsum.",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"Suspendisse fermentum feugiat augue eu convallis. Maecenas eros velit, efficitur sit amet posuere sed, tristique sit amet nisi. Donec vel convallis justo, id tempor neque. Nunc pulvinar maximus nulla, vitae congue lacus cursus ut. Morbi at mollis est, a vehicula nisi. Cras venenatis nibh vel massa interdum commodo. Nulla mattis ",
|
||||||
|
),
|
||||||
|
new Paragraph(
|
||||||
|
"neque sed sem bibendum, iaculis hendrerit neque fringilla. Sed a lobortis orci. Morbi in est sed libero vestibulum semper. Suspendisse potenti. Aliquam pretium erat tellus, in suscipit lorem aliquet iaculis. Aenean ac viverra ipsum. Sed at diam luctus, pharetra lorem vel, aliquam magna. Donec mollis orci eget enim efficitur ultricies. Proin neque diam, dignissim euismod ex vel, sollicitudin sodales sapien.",
|
||||||
|
),
|
||||||
|
|
||||||
|
new Paragraph(
|
||||||
|
"Sed a egestas nunc, a ullamcorper est. Aenean vulputate fringilla justo non vestibulum. Donec ac dolor in nisl finibus tristique. Donec sed turpis at felis congue porttitor sed sit amet metus. In in ex nulla. Donec sodales vel velit ut congue. Nullam vitae egestas purus. Vivamus non mi consequat, molestie enim nec, hendrerit mi.",
|
||||||
|
),
|
||||||
|
];
|
||||||
|
// cspell: enable
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -45,7 +181,20 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new TextRun("My Title "),
|
new TextRun("My Title "),
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: ["Footer - Page ", PageNumber.CURRENT],
|
children: ["Footer - Page ", PageNumber.CURRENT, " of ", PageNumber.TOTAL_PAGES],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
children: [
|
||||||
|
"Footer - Page in section ",
|
||||||
|
PageNumber.CURRENT_SECTION,
|
||||||
|
" of ",
|
||||||
|
PageNumber.TOTAL_PAGES_IN_SECTION,
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@ -70,6 +219,96 @@ const doc = new Document({
|
|||||||
children: [new TextRun("First Page"), new PageBreak()],
|
children: [new TextRun("First Page"), new PageBreak()],
|
||||||
}),
|
}),
|
||||||
new Paragraph("Second Page"),
|
new Paragraph("Second Page"),
|
||||||
|
...createLoremIpsumParagraphs(),
|
||||||
|
new Paragraph({
|
||||||
|
children: [new TextRun("Next Page"), new PageBreak()],
|
||||||
|
}),
|
||||||
|
...createLoremIpsumParagraphs(),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
properties: {
|
||||||
|
titlePage: true,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
default: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun("My Title "),
|
||||||
|
new TextRun({
|
||||||
|
children: ["Page ", PageNumber.CURRENT],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
first: new Header({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun("First Page Header "),
|
||||||
|
new TextRun({
|
||||||
|
children: ["Page ", PageNumber.CURRENT],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
footers: {
|
||||||
|
default: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun("My Title "),
|
||||||
|
new TextRun({
|
||||||
|
children: ["Footer - Page ", PageNumber.CURRENT, " of ", PageNumber.TOTAL_PAGES],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun({
|
||||||
|
children: [
|
||||||
|
"Footer - Page in section ",
|
||||||
|
PageNumber.CURRENT_SECTION,
|
||||||
|
" of ",
|
||||||
|
PageNumber.TOTAL_PAGES_IN_SECTION,
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
first: new Footer({
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
alignment: AlignmentType.RIGHT,
|
||||||
|
children: [
|
||||||
|
new TextRun("First Page Footer "),
|
||||||
|
new TextRun({
|
||||||
|
children: ["Page ", PageNumber.CURRENT],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [new TextRun("First Page"), new PageBreak()],
|
||||||
|
}),
|
||||||
|
new Paragraph("Second Page"),
|
||||||
|
...createLoremIpsumParagraphs(),
|
||||||
|
new Paragraph({
|
||||||
|
children: [new TextRun("Next Page"), new PageBreak()],
|
||||||
|
}),
|
||||||
|
...createLoremIpsumParagraphs(),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -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/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8iHx8iHSAiHiAjHiAjHx8jHx8hHx8iHx8iHyAiHiAjHiAjHiAjHh4hHx8iHx8iHx8iHyAjHSAjHiAjHiAjHh4hHx8iHx8iHx8jHyAjHiAhHh4iHx8iHx8jHyAjHSA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gj+paVozygY9plPMh28SaymO9kabAopREGF3vt9MzeFFl8G7lRSZ8FFGK8XX4VA8QjEd7XrM3M0OXz8YCy+qKBLgq3wqnofiTorF0Ax56Rg1J1elW+BBAsVe+My6iYq7IK6keBdOIseV2qn5Pb8f3MqkWAXf9ThM8c8lAOIotuFsF875lRrH5klRcG0+xcPwQ1oLxfeRAP4heQTnGL78X2rqlw2DK59SXAV/zKaiGMAuko5InCt68mcOan5+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/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAk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
@ -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: [
|
||||||
|
@ -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,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 { BorderStyle, Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -67,6 +67,173 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
new Paragraph("Table with borders"),
|
||||||
|
new Table({
|
||||||
|
rows: [
|
||||||
|
new TableRow({
|
||||||
|
children: [
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Dash small gap border")],
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.DASH_SMALL_GAP,
|
||||||
|
size: 1,
|
||||||
|
color: "000000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Dash small gap border")],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new TableRow({
|
||||||
|
children: [
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Double border")],
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.DOUBLE,
|
||||||
|
size: 1,
|
||||||
|
color: "ff0000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Double border")],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
new TableRow({
|
||||||
|
children: [
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Should have no border")],
|
||||||
|
}),
|
||||||
|
new TableCell({
|
||||||
|
borders: {
|
||||||
|
top: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
bottom: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
left: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
style: BorderStyle.NONE,
|
||||||
|
size: 0,
|
||||||
|
color: "ffffff",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Should have no border")],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -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/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8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jhT5LNUfAspZFiTwyC72KK7+DNg1SsRvCNp3gZXq2k4iEEXSHFJHgVXUlxejCCbTvFAHiXdIJiXxyCK7KJ5FHoMZGK9xBcwyg2QpdlVMxEUM2iyIMuXXZQNF+HswxMsSAAJRQjoE//eoqDCXBSTO6f1xd+O0iyNRY6jaWi1ALNYCocZROj4JdEikroVkjFk9DcStXxpdfCD2MoXodu4RUU9ptxxmXssOfxnvDVcxRTod9FxyhqLoAqis5aPhwTDp9spRgEH2Q6KLbYoKqlaKTm6Isp0C/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 @@
|
|||||||
// 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,7 +1,8 @@
|
|||||||
// 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 {
|
||||||
|
convertMillimetersToTwip,
|
||||||
Document,
|
Document,
|
||||||
HorizontalPositionAlign,
|
HorizontalPositionAlign,
|
||||||
HorizontalPositionRelativeFrom,
|
HorizontalPositionRelativeFrom,
|
||||||
@ -10,7 +11,7 @@ import {
|
|||||||
Paragraph,
|
Paragraph,
|
||||||
VerticalPositionAlign,
|
VerticalPositionAlign,
|
||||||
VerticalPositionRelativeFrom,
|
VerticalPositionRelativeFrom,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -41,6 +42,11 @@ const doc = new Document({
|
|||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
},
|
},
|
||||||
|
outline: {
|
||||||
|
type: "solidFill",
|
||||||
|
solidFillType: "rgb",
|
||||||
|
value: "FF0000",
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@ -55,6 +61,12 @@ const doc = new Document({
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
outline: {
|
||||||
|
type: "solidFill",
|
||||||
|
solidFillType: "rgb",
|
||||||
|
value: "0000FF",
|
||||||
|
width: convertMillimetersToTwip(600),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -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: {
|
||||||
@ -107,5 +107,5 @@ const doc = new Document({
|
|||||||
|
|
||||||
// Used to export the file into a .docx file
|
// Used to export the file into a .docx file
|
||||||
Packer.toBuffer(doc).then((buffer) => {
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
fs.writeFileSync("6-numbering.docx", buffer);
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
});
|
});
|
||||||
|
@ -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,7 +1,7 @@
|
|||||||
// 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: {
|
||||||
|
@ -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 @@
|
|||||||
// Example of using tab stops
|
// 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: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of a continuous header
|
// Example of a continuous header
|
||||||
// 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, SectionType, Tab, TextRun } from "../build";
|
import { Document, Footer, Header, Packer, Paragraph, SectionType, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Creator",
|
creator: "Creator",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Example of using headers and footers in a new section
|
// Example of using headers and footers in 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 { Document, Footer, Header, Packer, Paragraph, SectionType, Tab, TextRun } from "../build";
|
import { Document, Footer, Header, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Creator",
|
creator: "Creator",
|
||||||
|
@ -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 } from "../build";
|
import { Document, Packer, Paragraph } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
// Simple example apply positional tabs to a document
|
// Simple example apply positional tabs 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,
|
||||||
Packer,
|
Packer,
|
||||||
Paragraph,
|
Paragraph,
|
||||||
PositionalTab,
|
PositionalTab,
|
||||||
Tab,
|
|
||||||
TextRun,
|
TextRun,
|
||||||
PositionalTabAlignment,
|
PositionalTabAlignment,
|
||||||
PositionalTabRelativeTo,
|
PositionalTabRelativeTo,
|
||||||
PositionalTabLeader,
|
PositionalTabLeader,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Patch a document with patches
|
// Patch a document with patches
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
ExternalHyperlink,
|
ExternalHyperlink,
|
||||||
@ -14,7 +14,7 @@ import {
|
|||||||
TextDirection,
|
TextDirection,
|
||||||
TextRun,
|
TextRun,
|
||||||
VerticalAlign,
|
VerticalAlign,
|
||||||
} from "../build";
|
} from "docx";
|
||||||
|
|
||||||
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||||
patches: {
|
patches: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Generate a template document
|
// Generate a template 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 } from "../build";
|
import { Document, Packer, Paragraph, TextRun } from "docx";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Patch a document with patches
|
// Patch a document with patches
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { patchDocument, PatchType, TextRun } from "../build";
|
import { patchDocument, PatchType, TextRun } from "docx";
|
||||||
|
|
||||||
patchDocument(fs.readFileSync("demo/assets/simple-template-2.docx"), {
|
patchDocument(fs.readFileSync("demo/assets/simple-template-2.docx"), {
|
||||||
patches: {
|
patches: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Patch a document with patches
|
// Patch a document with patches
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { IPatch, patchDocument, PatchType, TextRun } from "../build";
|
import { IPatch, patchDocument, PatchType, TextRun } from "docx";
|
||||||
|
|
||||||
export const font = "Trebuchet MS";
|
export const font = "Trebuchet MS";
|
||||||
export const getPatches = (fields: { [key: string]: string }) => {
|
export const getPatches = (fields: { [key: string]: string }) => {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user