Compare commits
1 Commits
9.1.0
...
feature/pa
Author | SHA1 | Date | |
---|---|---|---|
c5a2c1c0cb |
55
.cspell.json
55
.cspell.json
@ -7,37 +7,31 @@
|
|||||||
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
||||||
// words - list of words to be always considered correct
|
// words - list of words to be always considered correct
|
||||||
"words": [
|
"words": [
|
||||||
"Abjad",
|
"Xmlable",
|
||||||
"aiueo",
|
|
||||||
"ATLEAST",
|
|
||||||
"chosung",
|
|
||||||
"clippy",
|
|
||||||
"datas",
|
|
||||||
"docsify",
|
|
||||||
"dolan",
|
|
||||||
"execa",
|
|
||||||
"falsey",
|
|
||||||
"horz",
|
|
||||||
"iife",
|
|
||||||
"Initializable",
|
|
||||||
"iroha",
|
|
||||||
"JOHAB",
|
|
||||||
"jsonify",
|
|
||||||
"jszip",
|
|
||||||
"NUMPAGES",
|
|
||||||
"odttf",
|
|
||||||
"ondata",
|
|
||||||
"onfile",
|
|
||||||
"ooxml",
|
|
||||||
"panose",
|
|
||||||
"rels",
|
|
||||||
"rsid",
|
|
||||||
"twip",
|
"twip",
|
||||||
"twips",
|
"twips",
|
||||||
"Xmlable",
|
"jsonify",
|
||||||
"xmlified",
|
"falsey",
|
||||||
|
"aiueo",
|
||||||
|
"iroha",
|
||||||
|
"aiueo",
|
||||||
|
"iroha",
|
||||||
|
"chosung",
|
||||||
|
"Abjad",
|
||||||
|
"Initializable",
|
||||||
|
"rels",
|
||||||
|
"dolan",
|
||||||
"xmlify",
|
"xmlify",
|
||||||
"Xmlifyed"
|
"Xmlifyed",
|
||||||
|
"xmlified",
|
||||||
|
"datas",
|
||||||
|
"jszip",
|
||||||
|
"rsid",
|
||||||
|
"NUMPAGES",
|
||||||
|
"ATLEAST",
|
||||||
|
"ooxml",
|
||||||
|
"clippy",
|
||||||
|
"docsify"
|
||||||
],
|
],
|
||||||
"ignoreRegExpList": [
|
"ignoreRegExpList": [
|
||||||
"/\"w:.+\"/",
|
"/\"w:.+\"/",
|
||||||
@ -55,10 +49,9 @@
|
|||||||
"\\.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", "*.docx", "build"],
|
"ignorePaths": ["package.json", "docs/api"],
|
||||||
"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.
|
||||||
|
272
.eslintrc.js
Normal file
272
.eslintrc.js
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
/*
|
||||||
|
👋 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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
243
.eslintrc.yml
243
.eslintrc.yml
@ -1,243 +0,0 @@
|
|||||||
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/no-restricted-types":
|
|
||||||
- error
|
|
||||||
- types:
|
|
||||||
Object:
|
|
||||||
message: Avoid using the `Object` type. Did you mean `object`?
|
|
||||||
fixWith: 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`?
|
|
||||||
fixWith: boolean
|
|
||||||
Number:
|
|
||||||
message: Avoid using the `Number` type. Did you mean `number`?
|
|
||||||
fixWith: number
|
|
||||||
String:
|
|
||||||
message: Avoid using the `String` type. Did you mean `string`?
|
|
||||||
fixWith: string
|
|
||||||
Symbol:
|
|
||||||
message: Avoid using the `Symbol` type. Did you mean `symbol`?
|
|
||||||
fixWith: 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
12
.github/actions/install-and-build/action.yml
vendored
@ -1,12 +0,0 @@
|
|||||||
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
14
.github/actions/validate-docx/action.yml
vendored
@ -1,14 +0,0 @@
|
|||||||
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,3 +5,36 @@ 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
|
||||||
|
25
.github/workflows/default.yml
vendored
25
.github/workflows/default.yml
vendored
@ -13,10 +13,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- uses: "./.github/actions/install-and-build"
|
- name: Install Dependencies
|
||||||
|
run: npm ci --force
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
- name: Archive Production Artifact
|
- name: Archive Production Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: build
|
name: build
|
||||||
path: build
|
path: build
|
||||||
@ -25,24 +28,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm run test:ci
|
run: npm run test.coverage
|
||||||
- name: Codecov
|
- name: Codecov
|
||||||
uses: codecov/codecov-action@v4
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
verbose: true
|
verbose: true
|
||||||
env:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Lint
|
- name: Lint
|
||||||
@ -52,17 +53,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Prettier
|
- name: Prettier
|
||||||
run: npm run prettier
|
run: npm run style
|
||||||
cspell:
|
cspell:
|
||||||
name: CSpell
|
name: CSpell
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Prettier
|
- name: Prettier
|
||||||
|
954
.github/workflows/demos.yml
vendored
954
.github/workflows/demos.yml
vendored
@ -8,189 +8,801 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
demos:
|
build:
|
||||||
name: Demos
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout Repo
|
||||||
- uses: "./.github/actions/install-and-build"
|
uses: actions/checkout@master
|
||||||
- name: Run Demos
|
- name: Install Dependencies
|
||||||
run: npm run run-ts -- ./demo/1-basic.ts
|
run: npm ci --force
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Build
|
||||||
- run: npm run run-ts -- ./demo/2-declaritive-styles.ts
|
run: npm run build
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Archive Production Artifact
|
||||||
- run: npm run run-ts -- ./demo/3-numbering-and-bullet-points.ts
|
uses: actions/upload-artifact@master
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/4-basic-table.ts
|
name: build
|
||||||
- uses: "./.github/actions/validate-docx"
|
path: build
|
||||||
- run: npm run run-ts -- ./demo/5-images.ts
|
demos:
|
||||||
- uses: "./.github/actions/validate-docx"
|
name: Run Demos and Validate
|
||||||
- run: npm run run-ts -- ./demo/6-page-borders.ts
|
needs: [build]
|
||||||
- uses: "./.github/actions/validate-docx"
|
runs-on: ubuntu-latest
|
||||||
- run: npm run run-ts -- ./demo/7-landscape.ts
|
steps:
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Checkout Repo
|
||||||
- run: npm run run-ts -- ./demo/8-header-footer.ts
|
uses: actions/checkout@master
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Install Dependencies
|
||||||
- run: npm run run-ts -- ./demo/9-images-in-header-and-footer.ts
|
run: npm ci --force
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Download Artifact
|
||||||
- run: npm run run-ts -- ./demo/10-my-cv.ts
|
uses: actions/download-artifact@master
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/11-declaritive-styles-2.ts
|
name: build
|
||||||
- uses: "./.github/actions/validate-docx"
|
path: build
|
||||||
- run: npm run run-ts -- ./demo/12-scaling-images.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/1-basic.ts
|
||||||
- run: npm run run-ts -- ./demo/13-xml-styles.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/14-page-numbers.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/15-page-break-before.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/16-multiple-sections.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/17-footnotes.ts
|
run: npm run ts-node -- ./demo/2-declaritive-styles.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/4-basic-table.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/5-images.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/6-page-borders.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/7-landscape.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/8-header-footer.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/9-images-in-header-and-footer.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/10-my-cv.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/11-declaritive-styles-2.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/12-scaling-images.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/13-xml-styles.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/14-page-numbers.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/15-page-break-before.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/16-multiple-sections.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/17-footnotes.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/18-image-from-buffer.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/19-export-to-base64.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/18-image-from-buffer.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/19-export-to-base64.ts
|
||||||
# Base 64 No longer works, abruptly. Node issue?
|
# Base 64 No longer works, abruptly. Node issue?
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Extract Word Document
|
||||||
- run: npm run run-ts -- ./demo/20-table-cell-borders.ts
|
# run: npm run extract
|
||||||
- uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/21-bookmarks.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
|
# with:
|
||||||
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/20-table-cell-borders.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/21-bookmarks.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# Bad ID - need numeric ID
|
# Bad ID - need numeric ID
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/22-right-to-left-text.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/23-base64-images.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/24-images-to-table-cell.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/22-right-to-left-text.ts
|
||||||
- run: npm run run-ts -- ./demo/25-table-xml-styles.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/26-paragraph-borders.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/27-declaritive-styles-3.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/28-table-of-contents.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/29-numbered-lists.ts
|
run: npm run ts-node -- ./demo/23-base64-images.ts
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Extract Word Document
|
||||||
- run: npm run run-ts -- ./demo/31-tables.ts
|
run: npm run extract
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/32-merge-and-shade-table-cells.ts
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/33-sequential-captions.ts
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/34-floating-tables.ts
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/24-images-to-table-cell.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/25-table-xml-styles.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/26-paragraph-borders.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/27-declaritive-styles-3.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/28-table-of-contents.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/29-numbered-lists.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/30-template-document.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/31-tables.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/33-sequential-captions.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/34-floating-tables.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr', attribute 'overlap': The attribute 'overlap' is not allowed.
|
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr', attribute 'overlap': The attribute 'overlap' is not allowed.
|
||||||
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr': Element content is not allowed, because the content type is empty.
|
# element tblpPr: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblpPr': Element content is not allowed, because the content type is empty.
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/35-hyperlinks.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/36-image-to-table-cell.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/37-images-to-header-and-footer.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/35-hyperlinks.ts
|
||||||
- run: npm run run-ts -- ./demo/38-text-wrapping.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/39-page-numbers.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/40-line-numbers.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/41-merge-table-cells-2.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/42-restart-page-numbers.ts
|
run: npm run ts-node -- ./demo/36-image-to-table-cell.ts
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Extract Word Document
|
||||||
- run: npm run run-ts -- ./demo/43-images-to-table-cell-2.ts
|
run: npm run extract
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/44-multiple-columns.ts
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/45-highlighting-text.ts
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/46-shading-text.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/37-images-to-header-and-footer.ts
|
||||||
- run: npm run run-ts -- ./demo/47-number-of-total-pages-section.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/48-vertical-align.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/49-table-borders.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/50-readme-demo.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/51-character-styles.ts
|
run: npm run ts-node -- ./demo/38-text-wrapping.ts
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Extract Word Document
|
||||||
- run: npm run run-ts -- ./demo/52-japanese.ts
|
run: npm run extract
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/53-chinese.ts
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/54-custom-properties.ts
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/55-math.ts
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/39-page-numbers.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/40-line-numbers.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/41-merge-table-cells-2.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/42-restart-page-numbers.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/43-images-to-table-cell-2.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/44-multiple-columns.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/45-highlighting-text.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/46-shading-text.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/47-number-of-total-pages-section.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/48-vertical-align.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/49-table-borders.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/50-readme-demo.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/51-character-styles.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/52-japanese.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/53-chinese.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/54-custom-properties.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/55-math.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
#: element subHide: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}subHide': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}ctrlPr ).
|
#: element subHide: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}subHide': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}ctrlPr ).
|
||||||
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sub ).
|
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sub ).
|
||||||
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sup ).
|
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sup ).
|
||||||
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sub ).
|
#: element e: Schemas validity error : Element '{http://schemas.openxmlformats.org/officeDocument/2006/math}e': This element is not expected. Expected is ( {http://schemas.openxmlformats.org/officeDocument/2006/math}sub ).
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/56-background-color.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/57-add-parent-numbered-lists.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/58-section-types.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/56-background-color.ts
|
||||||
- run: npm run run-ts -- ./demo/59-header-footer-margins.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/60-track-revisions.ts
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/57-add-parent-numbered-lists.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/58-section-types.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/59-header-footer-margins.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/60-track-revisions.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
# element r: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r': This element is not expected.
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/61-text-frame.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
|
# with:
|
||||||
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/61-text-frame.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# element left: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}left': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}right, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}between, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}bar ).
|
# element left: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}left': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}right, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}between, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}bar ).
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/62-paragraph-spacing.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/63-odd-even-header-footer.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/64-complex-numbering-text.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/62-paragraph-spacing.ts
|
||||||
- run: npm run run-ts -- ./demo/65-page-sizes.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/66-fields.ts
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/63-odd-even-header-footer.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/64-complex-numbering-text.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/65-page-sizes.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/66-fields.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
# element bookmarkStart: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
# element bookmarkStart: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
||||||
# element bookmarkEnd: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkEnd', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
# element bookmarkEnd: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkEnd', attribute '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id': '-irrswq-ln94j4fdgdjxs' is not a valid value of the atomic type '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_DecimalNumber'.
|
||||||
# - uses: "./.github/actions/validate-docx"
|
# - name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/67-column-break.ts
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
# with:
|
||||||
- run: npm run run-ts -- ./demo/68-numbering-instances-and-starting-number.ts
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/69-different-width-columns.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/67-column-break.ts
|
||||||
- run: npm run run-ts -- ./demo/70-line-numbers-suppression.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/71-page-borders-2.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/72-word-wrap.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/73-comments.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/74-nodejs-stream.ts
|
run: npm run ts-node -- ./demo/68-numbering-instances-and-starting-number.ts
|
||||||
# - uses: "./.github/actions/validate-docx"
|
- name: Extract Word Document
|
||||||
# run: npm run run-ts -- ./demo/75-tab-stops.ts
|
run: npm run extract
|
||||||
# - uses: "./.github/actions/validate-docx"
|
- name: Validate XML
|
||||||
- run: npm run run-ts -- ./demo/76-compatibility.ts
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- uses: "./.github/actions/validate-docx"
|
with:
|
||||||
- run: npm run run-ts -- ./demo/77-side-by-side-tables.ts
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- run: npm run run-ts -- ./demo/78-thai-distributed.ts
|
- name: Run Demo
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run ts-node -- ./demo/69-different-width-columns.ts
|
||||||
- run: npm run run-ts -- ./demo/79-table-from-data-source.ts
|
- name: Extract Word Document
|
||||||
- uses: "./.github/actions/validate-docx"
|
run: npm run extract
|
||||||
- run: npm run run-ts -- ./demo/80-thai-distributed.ts
|
- name: Validate XML
|
||||||
- uses: "./.github/actions/validate-docx"
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
- run: npm run run-ts -- ./demo/81-continuous-header.ts
|
with:
|
||||||
- uses: "./.github/actions/validate-docx"
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
- run: npm run run-ts -- ./demo/82-new-headers-new-section.ts
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Run Demo
|
||||||
- run: npm run run-ts -- ./demo/83-setting-languages.ts
|
run: npm run ts-node -- ./demo/70-line-numbers-suppression.ts
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Extract Word Document
|
||||||
- run: npm run run-ts -- ./demo/84-positional-tabs.ts
|
run: npm run extract
|
||||||
- uses: "./.github/actions/validate-docx"
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/71-page-borders-2.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/72-word-wrap.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/73-comments.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/73-comments.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
# - name: Run Demo
|
||||||
|
# run: npm run ts-node -- ./demo/75-tab-stops.ts
|
||||||
|
# - name: Extract Word Document
|
||||||
|
# run: npm run extract
|
||||||
|
# - name: Validate XML
|
||||||
|
# uses: ChristophWurst/xmllint-action@v1
|
||||||
|
# with:
|
||||||
|
# xml-file: build/extracted-doc/word/document.xml
|
||||||
|
# xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/76-compatibility.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/77-side-by-side-tables.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/78-thai-distributed.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/79-table-from-data-source.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/80-thai-distributed.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/81-continuous-header.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/82-new-headers-new-section.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/83-setting-languages.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
- name: Run Demo
|
||||||
|
run: npm run ts-node -- ./demo/84-positional-tabs.ts
|
||||||
|
- name: Extract Word Document
|
||||||
|
run: npm run extract
|
||||||
|
- name: Validate XML
|
||||||
|
uses: ChristophWurst/xmllint-action@v1
|
||||||
|
with:
|
||||||
|
xml-file: build/extracted-doc/word/document.xml
|
||||||
|
xml-schema-file: ooxml-schemas/microsoft/wml-2010.xsd
|
||||||
|
8
.github/workflows/github-pages.yml
vendored
8
.github/workflows/github-pages.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Build 🔧
|
- name: Build 🔧
|
||||||
@ -19,7 +19,7 @@ jobs:
|
|||||||
echo "docx.js.org" > docs/.nojekyll
|
echo "docx.js.org" > docs/.nojekyll
|
||||||
echo "docx.js.org" > docs/CNAME
|
echo "docx.js.org" > docs/CNAME
|
||||||
- name: Archive Production Artifact
|
- name: Archive Production Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: docs
|
name: docs
|
||||||
path: docs
|
path: docs
|
||||||
@ -28,11 +28,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo 🛎️
|
- name: Checkout Repo 🛎️
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@master
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@master
|
||||||
with:
|
with:
|
||||||
name: docs
|
name: docs
|
||||||
path: docs
|
path: docs
|
||||||
|
46
.github/workflows/npm-publish.yml
vendored
46
.github/workflows/npm-publish.yml
vendored
@ -1,46 +0,0 @@
|
|||||||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
||||||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
||||||
|
|
||||||
name: Node.js Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "20.x"
|
|
||||||
- run: npm ci --force
|
|
||||||
- run: npm run cspell
|
|
||||||
- run: npm run prettier
|
|
||||||
- run: npm run lint
|
|
||||||
- run: npm run test:ci
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "20.x"
|
|
||||||
- run: npm ci --force
|
|
||||||
- run: npm run build
|
|
||||||
|
|
||||||
publish-npm:
|
|
||||||
needs: [test, build]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "20.x"
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
- run: npm ci --force
|
|
||||||
- run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -60,5 +60,5 @@ My Document.docx
|
|||||||
# Temporary folder
|
# Temporary folder
|
||||||
tmp
|
tmp
|
||||||
|
|
||||||
# Exclude Mac .DS_Store files
|
# nyc
|
||||||
.DS_Store
|
.nyc_output
|
||||||
|
13
.mocharc.json
Normal file
13
.mocharc.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"diff": true,
|
||||||
|
"spec": "src/**/*.ts",
|
||||||
|
"extension": ["ts"],
|
||||||
|
"package": "./package.json",
|
||||||
|
"reporter": "spec",
|
||||||
|
"slow": "75",
|
||||||
|
"timeout": "2000",
|
||||||
|
"ui": "bdd",
|
||||||
|
"watch-files": ["src/**/*.ts"],
|
||||||
|
"watch-ignore": ["build", "demo"],
|
||||||
|
"require": ["mocha.env", "ts-node/register", "tsconfig-paths/register"]
|
||||||
|
}
|
@ -40,7 +40,4 @@ build-tests
|
|||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# docs
|
# docs
|
||||||
docs
|
docs
|
||||||
|
|
||||||
# src
|
|
||||||
src
|
|
25
.nycrc
Normal file
25
.nycrc
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"check-coverage": true,
|
||||||
|
"statements": 99.79,
|
||||||
|
"branches": 98.41,
|
||||||
|
"functions": 100,
|
||||||
|
"lines": 99.73,
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/import-dotx/import-dotx.ts"
|
||||||
|
],
|
||||||
|
"reporter": [
|
||||||
|
"lcov",
|
||||||
|
"text",
|
||||||
|
"json"
|
||||||
|
],
|
||||||
|
"extension": [
|
||||||
|
".ts"
|
||||||
|
],
|
||||||
|
"cache": true,
|
||||||
|
"all": true,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": []
|
|
||||||
}
|
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -5,6 +5,5 @@
|
|||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
"prettier.tabWidth": 4,
|
"prettier.tabWidth": 4,
|
||||||
"prettier.arrowParens": "always",
|
"prettier.arrowParens": "always",
|
||||||
"prettier.bracketSpacing": true,
|
"prettier.bracketSpacing": true
|
||||||
"eslint.useFlatConfig": true
|
|
||||||
}
|
}
|
||||||
|
20
.vscode/tasks.json
vendored
20
.vscode/tasks.json
vendored
@ -2,5 +2,23 @@
|
|||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
// for the documentation about the tasks.json format
|
// for the documentation about the tasks.json format
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": []
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "typescript",
|
||||||
|
"tsconfig": "tsconfig.json",
|
||||||
|
"option": "watch",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$tsc-watch"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "ts-node",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
Easily generate .docx files with JS/TS. Works for Node and on the Browser.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -12,6 +12,7 @@
|
|||||||
[![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]
|
||||||
|
|
||||||
@ -87,8 +88,6 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
|
|||||||
[<img src="https://i.imgur.com/cmykN7c.png" alt="drawing"/>](https://www.arity.co/)
|
[<img src="https://i.imgur.com/cmykN7c.png" alt="drawing"/>](https://www.arity.co/)
|
||||||
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
|
[<img src="https://i.imgur.com/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
|
||||||
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
||||||
[<img src="https://i.imgur.com/9tqJaHw.png" alt="drawing" height="50"/>](https://novelpad.co/)
|
|
||||||
[<img src="https://i.imgur.com/5bLKFeP.png" alt="drawing" height="50"/>](https://proton.me/)
|
|
||||||
|
|
||||||
...and many more!
|
...and many more!
|
||||||
|
|
||||||
@ -107,6 +106,8 @@ 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
|
||||||
|
24
SECURITY.md
24
SECURITY.md
@ -1,24 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported Versions
|
|
||||||
|
|
||||||
Use this section to tell people about which versions of your project are
|
|
||||||
currently being supported with security updates.
|
|
||||||
|
|
||||||
| Version | Supported |
|
|
||||||
| ------- | ------------------ |
|
|
||||||
| 9.0.x | :white_check_mark: |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
We encourage responsible disclosure of security vulnerabilities. If you believe you have found a security vulnerability in this project, please report it via the [Security Tab](https://github.com/dolanmiu/docx/security/advisories)
|
|
||||||
|
|
||||||
Please include the following information in your report:
|
|
||||||
|
|
||||||
* A description of the vulnerability
|
|
||||||
* Steps to reproduce the vulnerability
|
|
||||||
* Impact of the vulnerability
|
|
||||||
|
|
||||||
We will investigate all reported vulnerabilities and take appropriate action.
|
|
||||||
|
|
||||||
We appreciate your help in keeping this project secure.
|
|
@ -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 "docx";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, Tab, TabStopPosition, TabStopType, TextRun } from "../build";
|
||||||
|
|
||||||
// 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 "docx";
|
} from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, ImageRun, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, HeadingLevel, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
const styles = fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8");
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Page numbers
|
// Page numbers
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "docx";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -45,7 +45,7 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new TextRun("My Title "),
|
new TextRun("My Title "),
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: ["Footer - Page ", PageNumber.CURRENT, " of ", PageNumber.TOTAL_PAGES],
|
children: ["Footer - Page ", PageNumber.CURRENT],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -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 "docx";
|
import { Document, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Footer, Header, Packer, PageNumber, NumberFormat, PageOrientation, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, ImageRun, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8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uQmCC`;
|
||||||
|
|
||||||
|
@ -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 "docx";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
// 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 { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph, TextRun, UnderlineType } from "docx";
|
import {
|
||||||
|
AlignmentType,
|
||||||
|
convertInchesToTwip,
|
||||||
|
Document,
|
||||||
|
HeadingLevel,
|
||||||
|
LevelFormat,
|
||||||
|
Packer,
|
||||||
|
Paragraph,
|
||||||
|
TextRun,
|
||||||
|
UnderlineType,
|
||||||
|
} from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Clippy",
|
creator: "Clippy",
|
||||||
@ -43,15 +53,6 @@ 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 "docx";
|
import { BorderStyle, Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
// 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 { Bookmark, Document, Footer, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun, PageReference } from "docx";
|
import {
|
||||||
|
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 "docx";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, ImageRun, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8iHx8iHSAiHiAjHiAjHx8jHx8hHx8iHx8iHyAiHiAjHiAjHiAjHh4hHx8iHx8iHx8iHyAjHSAjHiAjHiAjHh4hHx8iHx8iHx8jHyAjHiAhHh4iHx8iHx8jHyAjHSAjHSAhHiAhHh4iHx8iHx8jHx8jHyAjHSAjHSAiHh4iHh4jHx8jHx8jHyAjHyAhHSAhHSAiHh4iHh4jHx8jHx8jHyAhHyAhHSAiHSAiHh4jHh4jHx8jHx8jHyAhHyAhHSAiHSAjHR4jHh4jHx8jHx8hHyAhHyAiHSAjHSAjHR4jHh4jHx8hHx8hHyAhHyAiHyAjHSAjHR4jHR4hHh4hHx8hHyAiHyAjHyAjHSAjHR4j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+z1pP8lQY/GHZQMV4YD3FpXDp4qerqbF/lBWBswyi+AL+ia+maLgcRRQj4IYlY/UpauqKBsPJAxQF8NM1TRQ/RudSPAD34rK3scOuR8/HGcspxsJfOVS8NZbiGXiUtPgINU3v3WFDmx8pEuG3EiqKKVbCC1vm2iZqap5LAtCtleQf8F9sFYWDohzeJczYyQ4V2bEZFGsQgJRGqqqhS2phHTWn9lDkIhBTqWqxQZ+IsRvtdHY9AvI2VX2hW68nfqGmuQsCEl3JdjfCF8OW1bPdtwhQ0gm2mQzfRE3a7KCYj0BNZJs8+Kxf/r6WtTEI2FIqlsMfFgRB5A6KUnSe/vUkX0AnuvUIt8SjM1m6wWQymUwmk8lkMgXRf5vi8rLQxtUhAAAAAElFTkSuQmCC`;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Add image to table cell
|
// Add image to table cell
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "docx";
|
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { BorderStyle, Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -25,17 +25,6 @@ const doc = new Document({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
|
||||||
text: "",
|
|
||||||
border: {
|
|
||||||
top: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new TextRun({
|
new TextRun({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Custom styles using JavaScript configuration
|
// Custom styles using JavaScript configuration
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, convertInchesToTwip, HeadingLevel, Packer, Paragraph, UnderlineType } from "docx";
|
import { Document, convertInchesToTwip, HeadingLevel, Packer, Paragraph, UnderlineType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { File, HeadingLevel, Packer, Paragraph, StyleLevel, TableOfContents } from "../build";
|
||||||
|
|
||||||
// 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 "docx";
|
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, convertInchesToTwip, Document, Footer, Header, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering: {
|
numbering: {
|
||||||
|
35
demo/30-template-document.ts
Normal file
35
demo/30-template-document.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Example on how to use a template document
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, ImportDotx, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
|
const importDotx = new ImportDotx();
|
||||||
|
const filePath = "./demo/dotx/template.dotx";
|
||||||
|
|
||||||
|
fs.readFile(filePath, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
throw new Error(`Failed to read file ${filePath}.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
importDotx.extract(data).then((templateDocument) => {
|
||||||
|
const doc = new Document(
|
||||||
|
{
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
properties: {
|
||||||
|
titlePage: templateDocument.titlePageIsDefined,
|
||||||
|
},
|
||||||
|
children: [new Paragraph("Hello World")],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
template: templateDocument,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My Document.docx", buffer);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -1,7 +1,7 @@
|
|||||||
// Example of how you would create a table and add data to it
|
// Example of how you would create a table and add data to it
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "docx";
|
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Example of how you would merge cells together (Rows and Columns) and apply shading
|
// Example of how you would merge cells together (Rows and Columns) and apply shading
|
||||||
// Also includes an example on how to center tables
|
// Also includes an example on how to center tables
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
AlignmentType,
|
AlignmentType,
|
||||||
@ -15,7 +15,7 @@ import {
|
|||||||
TableCell,
|
TableCell,
|
||||||
TableRow,
|
TableRow,
|
||||||
WidthType,
|
WidthType,
|
||||||
} from "docx";
|
} from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, SequentialIdentifier, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
} from "../build";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,21 +1,9 @@
|
|||||||
// 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 "docx";
|
import { Document, ExternalHyperlink, Footer, FootnoteReferenceRun, ImageRun, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Header, ImageRun, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Header, ImageRun, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
// import { Document, Packer, Paragraph } from "../build";
|
||||||
import { Document, ImageRun, Packer, Paragraph, TextWrappingSide, TextWrappingType } from "docx";
|
import { Document, ImageRun, Packer, Paragraph, TextWrappingSide, TextWrappingType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, PageNumberSeparator, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
||||||
|
|
||||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8iHx8iHSAiHiAjHiAjHx8jHx8hHx8iHx8iHyAiHiAjHiAjHiAjHh4hHx8iHx8iHx8iHyAjHSAjHiAjHiAjHh4hHx8iHx8iHx8jHyAjHiAhHh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8YiuncIxEuzUUg4Dkgj+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 "docx";
|
import { Document, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Header, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Header, Packer, Paragraph, ShadingType, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, PageNumber, NumberFormat, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, VerticalAlign, TextRun, Tab } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
} from "../build";
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
rows: [
|
rows: [
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// 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,
|
||||||
@ -11,7 +10,7 @@ import {
|
|||||||
Paragraph,
|
Paragraph,
|
||||||
VerticalPositionAlign,
|
VerticalPositionAlign,
|
||||||
VerticalPositionRelativeFrom,
|
VerticalPositionRelativeFrom,
|
||||||
} from "docx";
|
} from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -21,7 +20,6 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "jpg",
|
|
||||||
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 100,
|
width: 100,
|
||||||
@ -38,24 +36,17 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "png",
|
|
||||||
data: fs.readFileSync("./demo/images/dog.png").toString("base64"),
|
data: fs.readFileSync("./demo/images/dog.png").toString("base64"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
},
|
},
|
||||||
outline: {
|
|
||||||
type: "solidFill",
|
|
||||||
solidFillType: "rgb",
|
|
||||||
value: "FF0000",
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "jpg",
|
|
||||||
data: fs.readFileSync("./demo/images/cat.jpg"),
|
data: fs.readFileSync("./demo/images/cat.jpg"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 100,
|
width: 100,
|
||||||
@ -64,19 +55,12 @@ const doc = new Document({
|
|||||||
vertical: true,
|
vertical: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
outline: {
|
|
||||||
type: "solidFill",
|
|
||||||
solidFillType: "rgb",
|
|
||||||
value: "0000FF",
|
|
||||||
width: convertMillimetersToTwip(600),
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "bmp",
|
|
||||||
data: fs.readFileSync("./demo/images/parrots.bmp"),
|
data: fs.readFileSync("./demo/images/parrots.bmp"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 150,
|
width: 150,
|
||||||
@ -92,7 +76,6 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "gif",
|
|
||||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -108,7 +91,6 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "gif",
|
|
||||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -130,7 +112,6 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ImageRun({
|
new ImageRun({
|
||||||
type: "jpg",
|
|
||||||
data: fs.readFileSync("./demo/images/cat.jpg"),
|
data: fs.readFileSync("./demo/images/cat.jpg"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -150,22 +131,6 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new ImageRun({
|
|
||||||
type: "svg",
|
|
||||||
data: fs.readFileSync("./demo/images/linux-svg.svg"),
|
|
||||||
transformation: {
|
|
||||||
width: 200,
|
|
||||||
height: 200,
|
|
||||||
},
|
|
||||||
fallback: {
|
|
||||||
type: "png",
|
|
||||||
data: fs.readFileSync("./demo/images/linux-png.png"),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -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 "docx";
|
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, HeadingLevel, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
// 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 "docx";
|
import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
styles: {
|
styles: {
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
// 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 "docx";
|
import { Document, Packer } from "../build";
|
||||||
|
|
||||||
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,9 +21,7 @@ import {
|
|||||||
Packer,
|
Packer,
|
||||||
Paragraph,
|
Paragraph,
|
||||||
TextRun,
|
TextRun,
|
||||||
MathLimitLower,
|
} from "../build";
|
||||||
MathLimitUpper,
|
|
||||||
} from "docx";
|
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -318,23 +316,6 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new Math({
|
|
||||||
children: [
|
|
||||||
new MathLimitUpper({
|
|
||||||
children: [new MathRun("x")],
|
|
||||||
limit: [new MathRun("-")],
|
|
||||||
}),
|
|
||||||
new MathRun("="),
|
|
||||||
new MathLimitLower({
|
|
||||||
children: [new MathRun("lim")],
|
|
||||||
limit: [new MathRun("x→0")],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -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 "docx";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, TextRun, SectionType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Footer, Header, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, HeadingLevel, Packer, Paragraph, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
} from "../build";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For reference, see
|
For reference, see
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// 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 {
|
||||||
AlignmentType,
|
|
||||||
BorderStyle,
|
BorderStyle,
|
||||||
Document,
|
Document,
|
||||||
FrameAnchorType,
|
FrameAnchorType,
|
||||||
@ -12,7 +11,7 @@ import {
|
|||||||
Tab,
|
Tab,
|
||||||
TextRun,
|
TextRun,
|
||||||
VerticalPositionAlign,
|
VerticalPositionAlign,
|
||||||
} from "docx";
|
} from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
@ -21,7 +20,6 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
frame: {
|
frame: {
|
||||||
type: "absolute",
|
|
||||||
position: {
|
position: {
|
||||||
x: 1000,
|
x: 1000,
|
||||||
y: 3000,
|
y: 3000,
|
||||||
@ -32,54 +30,6 @@ const doc = new Document({
|
|||||||
horizontal: FrameAnchorType.MARGIN,
|
horizontal: FrameAnchorType.MARGIN,
|
||||||
vertical: FrameAnchorType.MARGIN,
|
vertical: FrameAnchorType.MARGIN,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
border: {
|
|
||||||
top: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
bottom: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
left: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
right: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
new TextRun("Hello World"),
|
|
||||||
new TextRun({
|
|
||||||
text: "Foo Bar",
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
new TextRun({
|
|
||||||
children: [new Tab(), "Github is the best"],
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
new Paragraph({
|
|
||||||
frame: {
|
|
||||||
type: "alignment",
|
|
||||||
width: 4000,
|
|
||||||
height: 1000,
|
|
||||||
anchor: {
|
|
||||||
horizontal: FrameAnchorType.MARGIN,
|
|
||||||
vertical: FrameAnchorType.MARGIN,
|
|
||||||
},
|
|
||||||
alignment: {
|
alignment: {
|
||||||
x: HorizontalPositionAlign.CENTER,
|
x: HorizontalPositionAlign.CENTER,
|
||||||
y: VerticalPositionAlign.TOP,
|
y: VerticalPositionAlign.TOP,
|
||||||
@ -123,59 +73,6 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
|
||||||
frame: {
|
|
||||||
type: "alignment",
|
|
||||||
width: 4000,
|
|
||||||
height: 1000,
|
|
||||||
anchor: {
|
|
||||||
horizontal: FrameAnchorType.MARGIN,
|
|
||||||
vertical: FrameAnchorType.MARGIN,
|
|
||||||
},
|
|
||||||
alignment: {
|
|
||||||
x: HorizontalPositionAlign.CENTER,
|
|
||||||
y: VerticalPositionAlign.BOTTOM,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
border: {
|
|
||||||
top: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
bottom: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
left: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
right: {
|
|
||||||
color: "auto",
|
|
||||||
space: 1,
|
|
||||||
style: BorderStyle.SINGLE,
|
|
||||||
size: 6,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
alignment: AlignmentType.RIGHT,
|
|
||||||
children: [
|
|
||||||
new TextRun("Hello World"),
|
|
||||||
new TextRun({
|
|
||||||
text: "Foo Bar",
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
new TextRun({
|
|
||||||
children: [new Tab(), "Github is the best"],
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -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 "docx";
|
import { Document, LineRuleType, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Footer, Header, Packer, PageBreak, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, LevelFormat } from "../build";
|
||||||
|
|
||||||
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("My Document.docx", buffer);
|
fs.writeFileSync("6-numbering.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 "docx";
|
import { convertMillimetersToTwip, Document, Packer, PageOrientation, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Bookmark, Document, Packer, Paragraph, SimpleField, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, ColumnBreak, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, LevelFormat } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Column, Document, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, PageOrientation, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, HeadingLevel, LineNumberRestartFormat, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, TextRun, Paragraph, BorderStyle, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder } from "../build";
|
||||||
|
|
||||||
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 } from "docx";
|
import { Document, Packer, Paragraph, TextRun, SpaceType } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,87 +1,11 @@
|
|||||||
// 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 "docx";
|
import { Document, Packer, Paragraph, TextRun, CommentRangeStart, CommentRangeEnd, CommentReference } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
comments: {
|
comments: {
|
||||||
children: [
|
children: [{ id: 0, author: "Ray Chen", date: new Date(), text: "comment text content" }],
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
author: "Ray Chen",
|
|
||||||
date: new Date(),
|
|
||||||
children: [
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "some initial text content",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "comment text content",
|
|
||||||
}),
|
|
||||||
new TextRun({ text: "", break: 1 }),
|
|
||||||
new TextRun({
|
|
||||||
text: "More text here",
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
author: "Bob Ross",
|
|
||||||
date: new Date(),
|
|
||||||
children: [
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "Some initial text content",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "comment text content",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
author: "John Doe",
|
|
||||||
date: new Date(),
|
|
||||||
children: [
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "Hello World",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
author: "Beatriz",
|
|
||||||
date: new Date(),
|
|
||||||
children: [
|
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new TextRun({
|
|
||||||
text: "Another reply",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
@ -102,32 +26,6 @@ const doc = new Document({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
|
||||||
children: [
|
|
||||||
new CommentRangeStart(1),
|
|
||||||
new CommentRangeStart(2),
|
|
||||||
new CommentRangeStart(3),
|
|
||||||
new TextRun({
|
|
||||||
text: "Some text which need commenting",
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
new CommentRangeEnd(1),
|
|
||||||
new TextRun({
|
|
||||||
children: [new CommentReference(1)],
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
new CommentRangeEnd(2),
|
|
||||||
new TextRun({
|
|
||||||
children: [new CommentReference(2)],
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
new CommentRangeEnd(3),
|
|
||||||
new TextRun({
|
|
||||||
children: [new CommentReference(3)],
|
|
||||||
bold: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Exporting the document as a stream
|
// Exporting the document as a stream
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Tab, TextRun } from "docx";
|
import { Document, Packer, Paragraph, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
|
@ -1,24 +1,23 @@
|
|||||||
// 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 "docx";
|
import { Document, HeadingLevel, Packer, Paragraph, TabStopPosition, TabStopType, TextRun } from "../build";
|
||||||
|
|
||||||
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 },
|
||||||
];
|
],
|
||||||
const twoTabStops = [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }];
|
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 "docx";
|
import { Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Packer, Paragraph, Table, TableBorders, TableCell, TableRow, WidthType } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
} from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { Document, Footer, Header, Packer, Paragraph } from "../build";
|
||||||
|
|
||||||
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 "docx";
|
import { AlignmentType, convertMillimetersToTwip, Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
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, TextRun } from "docx";
|
import { Document, Footer, Header, Packer, Paragraph, SectionType, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
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, TextRun } from "docx";
|
import { Document, Footer, Header, Packer, Paragraph, SectionType, Tab, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: "Creator",
|
creator: "Creator",
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user