Compare commits

..

58 Commits
7.1.1 ... 7.1.2

Author SHA1 Message Date
9547805ec2 Version bump 2021-11-01 00:42:30 +00:00
89040e0237 Merge pull request #1271 from dolanmiu/feature/page-border-demos
#1256 Add page border demos
2021-10-31 21:47:21 +00:00
dd657a9e88 Fix typo 2021-10-31 20:25:52 +00:00
fe21bb1702 #1256 Add page border demos 2021-10-30 19:34:16 +01:00
a01d352925 Merge pull request #1241 from dolanmiu/dependabot/npm_and_yarn/webpack-cli-4.9.1
Bump webpack-cli from 4.9.0 to 4.9.1
2021-10-29 12:39:18 +01:00
e1fb07989f Merge pull request #1242 from dolanmiu/dependabot/npm_and_yarn/types/glob-7.2.0
Bump @types/glob from 7.1.4 to 7.2.0
2021-10-29 12:39:10 +01:00
b0d6be1929 Merge pull request #1251 from dolanmiu/dependabot/npm_and_yarn/replace-in-file-6.3.2
Bump replace-in-file from 6.3.1 to 6.3.2
2021-10-29 12:38:40 +01:00
a2e0c66dc8 Merge pull request #1252 from dolanmiu/dependabot/npm_and_yarn/ts-node-10.4.0
Bump ts-node from 10.3.0 to 10.4.0
2021-10-29 12:38:33 +01:00
fe028c3ac1 Merge pull request #1253 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.22.7
Bump typedoc from 0.22.6 to 0.22.7
2021-10-29 12:38:26 +01:00
92ef5805b8 Merge pull request #1258 from dolanmiu/dependabot/npm_and_yarn/types/sinon-10.0.6
Bump @types/sinon from 10.0.4 to 10.0.6
2021-10-29 12:38:19 +01:00
e30f3b2035 Merge pull request #1259 from dolanmiu/dependabot/npm_and_yarn/types/node-16.11.6
Bump @types/node from 16.11.1 to 16.11.6
2021-10-29 12:38:12 +01:00
cdcaba651c Merge pull request #1260 from dolanmiu/dependabot/npm_and_yarn/webpack-5.60.0
Bump webpack from 5.58.2 to 5.60.0
2021-10-29 12:38:04 +01:00
63aff461ed Merge pull request #1262 from devoidfury/fix/bookmark-schema-issue-ids
fix #1261 use numeric ids with bookmarks
2021-10-27 14:03:24 +01:00
54565e2228 fix #1261 use numeric ids with bookmarkStart and bookmarkEnd to conform to schema 2021-10-26 20:10:10 -05:00
cce6d3fcbe Bump webpack from 5.58.2 to 5.60.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.2 to 5.60.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.2...v5.60.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-26 11:01:50 +00:00
26809a33c6 Bump @types/node from 16.11.1 to 16.11.6
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 16.11.1 to 16.11.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-26 11:01:25 +00:00
030594ccae Bump @types/sinon from 10.0.4 to 10.0.6
Bumps [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) from 10.0.4 to 10.0.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

---
updated-dependencies:
- dependency-name: "@types/sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-26 11:01:10 +00:00
396470886c Bump typedoc from 0.22.6 to 0.22.7
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.22.6 to 0.22.7.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.22.6...v0.22.7)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-25 11:01:38 +00:00
0408a2808c Bump ts-node from 10.3.0 to 10.4.0
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.3.0 to 10.4.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v10.3.0...v10.4.0)

---
updated-dependencies:
- dependency-name: ts-node
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-25 11:01:18 +00:00
14f9347311 Bump replace-in-file from 6.3.1 to 6.3.2
Bumps [replace-in-file](https://github.com/adamreisnz/replace-in-file) from 6.3.1 to 6.3.2.
- [Release notes](https://github.com/adamreisnz/replace-in-file/releases)
- [Changelog](https://github.com/adamreisnz/replace-in-file/blob/main/CHANGELOG.md)
- [Commits](https://github.com/adamreisnz/replace-in-file/compare/v6.3.1...v6.3.2)

---
updated-dependencies:
- dependency-name: replace-in-file
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-25 11:01:04 +00:00
40747603e8 Bump @types/glob from 7.1.4 to 7.2.0
Bumps [@types/glob](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/glob) from 7.1.4 to 7.2.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/glob)

---
updated-dependencies:
- dependency-name: "@types/glob"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-20 11:01:21 +00:00
608ba89c7c Bump webpack-cli from 4.9.0 to 4.9.1
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.9.0 to 4.9.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.9.0...webpack-cli@4.9.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-19 11:01:21 +00:00
f34d4833a8 Merge pull request #1240 from dolanmiu/dependabot/npm_and_yarn/replace-in-file-6.3.1
Bump replace-in-file from 6.2.0 to 6.3.1
2021-10-18 13:25:52 +01:00
051a1226c0 Merge pull request #1239 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.22.6
Bump typedoc from 0.22.5 to 0.22.6
2021-10-18 13:25:45 +01:00
5b2350c01c Merge pull request #1238 from dolanmiu/dependabot/npm_and_yarn/types/node-16.11.1
Bump @types/node from 16.10.3 to 16.11.1
2021-10-18 13:25:37 +01:00
0ffc114005 Merge pull request #1235 from dolanmiu/dependabot/npm_and_yarn/mocha-9.1.3
Bump mocha from 9.1.2 to 9.1.3
2021-10-18 13:25:30 +01:00
ff25a4faa5 Merge pull request #1231 from dolanmiu/dependabot/npm_and_yarn/nanoid-3.1.30
Bump nanoid from 3.1.29 to 3.1.30
2021-10-18 13:25:23 +01:00
e73b12cd76 Merge pull request #1228 from dolanmiu/dependabot/npm_and_yarn/webpack-5.58.2
Bump webpack from 5.58.1 to 5.58.2
2021-10-18 13:25:16 +01:00
7a2f209430 Merge pull request #1227 from dolanmiu/dependabot/npm_and_yarn/typescript-4.4.4
Bump typescript from 4.4.3 to 4.4.4
2021-10-18 13:25:09 +01:00
0174e9b423 Bump replace-in-file from 6.2.0 to 6.3.1
Bumps [replace-in-file](https://github.com/adamreisnz/replace-in-file) from 6.2.0 to 6.3.1.
- [Release notes](https://github.com/adamreisnz/replace-in-file/releases)
- [Changelog](https://github.com/adamreisnz/replace-in-file/blob/main/CHANGELOG.md)
- [Commits](https://github.com/adamreisnz/replace-in-file/compare/v6.2.0...v6.3.1)

---
updated-dependencies:
- dependency-name: replace-in-file
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 11:02:23 +00:00
794571c7e1 Bump typedoc from 0.22.5 to 0.22.6
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.22.5 to 0.22.6.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.22.5...v0.22.6)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 11:01:58 +00:00
c34a4f2613 Bump @types/node from 16.10.3 to 16.11.1
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 16.10.3 to 16.11.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 11:01:33 +00:00
f648ecf0b8 Bump mocha from 9.1.2 to 9.1.3
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.2 to 9.1.3.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.2...v9.1.3)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-15 11:01:19 +00:00
e1cc557bec Bump nanoid from 3.1.29 to 3.1.30
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.29 to 3.1.30.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.29...3.1.30)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-14 11:01:25 +00:00
2310b7f479 Bump webpack from 5.58.1 to 5.58.2
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.1 to 5.58.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.1...v5.58.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-13 11:01:42 +00:00
e64bb9c7b9 Bump typescript from 4.4.3 to 4.4.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.4.3 to 4.4.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.4.3...v4.4.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-13 11:01:24 +00:00
af98f80db0 Merge pull request #1226 from dolanmiu/dependabot/npm_and_yarn/ts-node-10.3.0
Bump ts-node from 10.2.1 to 10.3.0
2021-10-12 15:37:28 +01:00
8a704776d2 Merge pull request #1224 from dolanmiu/dependabot/npm_and_yarn/webpack-5.58.1
Bump webpack from 5.58.0 to 5.58.1
2021-10-12 15:37:21 +01:00
67a205cae7 Bump ts-node from 10.2.1 to 10.3.0
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.2.1 to 10.3.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v10.2.1...v10.3.0)

---
updated-dependencies:
- dependency-name: ts-node
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-12 11:01:29 +00:00
1fb1f50756 Bump webpack from 5.58.0 to 5.58.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.0 to 5.58.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.0...v5.58.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 11:01:29 +00:00
50049113b5 Merge pull request #1222 from tadmi/patch-1
comments fix
2021-10-11 01:18:51 +01:00
49694a53fd Merge pull request #1217 from curvenote/feat/revision
Change type of revision to a number
2021-10-09 20:42:28 +01:00
ead04d0764 comments fix
Fixed a comments about the behavior default, first, even Header and Footer when activating options:
Different Odd & Even Pages
Different First Page
2021-10-09 19:52:46 +03:00
47099d0468 Change type of revision to a number 2021-10-08 15:55:58 -06:00
abbd620220 Merge pull request #1216 from dolanmiu/dependabot/npm_and_yarn/webpack-5.58.0
Bump webpack from 5.57.1 to 5.58.0
2021-10-08 17:49:46 +01:00
303b025aee Bump webpack from 5.57.1 to 5.58.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.57.1 to 5.58.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.57.1...v5.58.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-08 11:01:23 +00:00
1421b06df7 Merge pull request #1215 from dolanmiu/dependabot/npm_and_yarn/webpack-cli-4.9.0
Bump webpack-cli from 4.8.0 to 4.9.0
2021-10-07 12:16:57 +01:00
1e37282e06 Bump webpack-cli from 4.8.0 to 4.9.0
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.8.0 to 4.9.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.8.0...webpack-cli@4.9.0)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-07 11:01:20 +00:00
7b992ed254 Merge pull request #1209 from dolanmiu/dependabot/npm_and_yarn/webpack-5.57.1
Bump webpack from 5.56.1 to 5.57.1
2021-10-06 12:54:39 +01:00
deba94d69c Merge pull request #1210 from dolanmiu/dependabot/npm_and_yarn/nanoid-3.1.29
Bump nanoid from 3.1.28 to 3.1.29
2021-10-06 12:53:17 +01:00
5e09c27a0d Merge pull request #1211 from dolanmiu/dependabot/npm_and_yarn/types/node-16.10.3
Bump @types/node from 16.10.2 to 16.10.3
2021-10-06 12:53:09 +01:00
31563f53ec Bump @types/node from 16.10.2 to 16.10.3
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 16.10.2 to 16.10.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 11:02:14 +00:00
a967e560c6 Bump nanoid from 3.1.28 to 3.1.29
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.28 to 3.1.29.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.28...3.1.29)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 11:01:56 +00:00
c4427f7bb9 Bump webpack from 5.56.1 to 5.57.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.56.1 to 5.57.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.56.1...v5.57.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 11:01:38 +00:00
a563659eca Merge pull request #1207 from dolanmiu/dependabot/npm_and_yarn/webpack-5.56.1
Bump webpack from 5.55.1 to 5.56.1
2021-10-05 00:27:41 +01:00
caca11d807 Merge pull request #1208 from dolanmiu/dependabot/npm_and_yarn/typedoc-0.22.5
Bump typedoc from 0.22.4 to 0.22.5
2021-10-05 00:27:33 +01:00
c79d68d83e Bump typedoc from 0.22.4 to 0.22.5
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.22.4 to 0.22.5.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.22.4...v0.22.5)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 11:01:41 +00:00
7af63f4b0c Bump webpack from 5.55.1 to 5.56.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.55.1 to 5.56.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.55.1...v5.56.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 11:01:14 +00:00
13 changed files with 311 additions and 144 deletions

View File

@ -679,3 +679,12 @@ jobs:
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

63
demo/71-page-borders-2.ts Normal file
View File

@ -0,0 +1,63 @@
// 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 { Document, Packer, TextRun, Paragraph, BorderStyle, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder } from "../build";
const doc = new Document({
sections: [
{
properties: {
page: {
borders: {
pageBorderBottom: {
style: BorderStyle.SINGLE,
size: 2 * 8, //2pt;
color: "000000",
},
pageBorderLeft: {
style: BorderStyle.SINGLE,
size: 1 * 8, //1pt;
color: "000000",
},
pageBorderRight: {
style: BorderStyle.SINGLE,
size: 1 * 8, //1pt;
color: "FF00AA",
},
pageBorderTop: {
style: BorderStyle.SINGLE,
size: 1 * 8, //1pt;
color: "000000",
},
pageBorders: {
display: PageBorderDisplay.ALL_PAGES,
offsetFrom: PageBorderOffsetFrom.TEXT,
zOrder: PageBorderZOrder.FRONT,
},
},
},
},
children: [
new Paragraph({
children: [
new TextRun({
text: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.`,
}),
],
}),
new Paragraph({
children: [
new TextRun({
text: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.`,
}),
],
}),
],
},
],
});
// Used to export the file into a .docx file
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});

View File

@ -8,24 +8,24 @@ Every Section has a sections which you can define its Headers and Footers:
const doc = new Document({
sections: [{
headers: {
default: new Header({ // The standard default header
default: new Header({ // The standard default header on every page or header on odd pages when the 'Different Odd & Even Pages' option is activated
children: [],
}),
first: new Header({ // The first header
first: new Header({ // The header on first page when the 'Different First Page' option is activated
children: [],
}),
even: new Header({ // The header on every other page
even: new Header({ // The header on even pages when the 'Different Odd & Even Pages' option is activated
children: [],
}),
},
footers: {
default: new Footer({ // The standard default footer
default: new Footer({ // The standard default footer on every page or footer on odd pages when the 'Different Odd & Even Pages' option is activated
children: [],
}),
first: new Footer({ // The first footer
first: new Footer({ // The footer on first page when the 'Different First Page' option is activated
children: [],
}),
even: new Footer({ // The footer on every other page
even: new Footer({ // The footer on even pages when the 'Different Odd & Even Pages' option is activated
children: [],
}),
},

304
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "docx",
"version": "7.1.0",
"version": "7.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -395,18 +395,18 @@
"dev": true
},
"@cspotcode/source-map-support": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz",
"integrity": "sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
"integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
"dev": true,
"requires": {
"@cspotcode/source-map-consumer": "0.8.0"
}
},
"@discoveryjs/json-ext": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz",
"integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz",
"integrity": "sha512-6nFkfkmSeV/rqSaS4oWHgmpnYw194f6hmWF5is6b0J1naJZoiD0NTc9AiUwPHvWsowkjuHErCZT1wa0jg+BLIA==",
"dev": true
},
"@istanbuljs/load-nyc-config": {
@ -585,9 +585,9 @@
"dev": true
},
"@types/eslint": {
"version": "7.28.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz",
"integrity": "sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==",
"version": "7.28.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.2.tgz",
"integrity": "sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA==",
"dev": true,
"requires": {
"@types/estree": "*",
@ -611,9 +611,9 @@
"dev": true
},
"@types/glob": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz",
"integrity": "sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==",
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
"dev": true,
"requires": {
"@types/minimatch": "*",
@ -645,9 +645,9 @@
"dev": true
},
"@types/node": {
"version": "16.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz",
"integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ=="
"version": "16.11.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
"integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
},
"@types/prompt": {
"version": "1.1.1",
@ -711,9 +711,9 @@
}
},
"@types/sinon": {
"version": "10.0.4",
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.4.tgz",
"integrity": "sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA==",
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.6.tgz",
"integrity": "sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==",
"dev": true,
"requires": {
"@sinonjs/fake-timers": "^7.1.0"
@ -898,24 +898,24 @@
}
},
"@webpack-cli/configtest": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.4.tgz",
"integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz",
"integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==",
"dev": true
},
"@webpack-cli/info": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.3.0.tgz",
"integrity": "sha512-ASiVB3t9LOKHs5DyVUcxpraBXDOKubYu/ihHhU+t1UPpxsivg6Od2E2qU4gJCekfEddzRBzHhzA/Acyw/mlK/w==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz",
"integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==",
"dev": true,
"requires": {
"envinfo": "^7.7.3"
}
},
"@webpack-cli/serve": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.2.tgz",
"integrity": "sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz",
"integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==",
"dev": true
},
"@xtuc/ieee754": {
@ -937,9 +937,9 @@
"dev": true
},
"acorn-import-assertions": {
"version": "1.7.6",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.7.6.tgz",
"integrity": "sha512-FlVvVFA1TX6l3lp8VjDnYYq7R1nyW6x3svAt4nDgrWQ9SBaSh9CnbwgSUTasgfNfOG5HlM1ehugCvM+hjo56LA==",
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
"integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
"dev": true
},
"acorn-walk": {
@ -1305,16 +1305,16 @@
"dev": true
},
"browserslist": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.1.tgz",
"integrity": "sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ==",
"version": "4.17.5",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz",
"integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==",
"dev": true,
"requires": {
"caniuse-lite": "^1.0.30001259",
"electron-to-chromium": "^1.3.846",
"caniuse-lite": "^1.0.30001271",
"electron-to-chromium": "^1.3.878",
"escalade": "^3.1.1",
"nanocolors": "^0.1.5",
"node-releases": "^1.1.76"
"node-releases": "^2.0.1",
"picocolors": "^1.0.0"
}
},
"buffer": {
@ -1416,9 +1416,9 @@
"dev": true
},
"caniuse-lite": {
"version": "1.0.30001261",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz",
"integrity": "sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==",
"version": "1.0.30001271",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001271.tgz",
"integrity": "sha512-BBruZFWmt3HFdVPS8kceTBIguKxu4f99n5JNp06OlPD/luoAMIaIK5ieV5YjnBLH3Nysai9sxj9rpJj4ZisXOA==",
"dev": true
},
"caseless": {
@ -1585,9 +1585,9 @@
"dev": true
},
"colorette": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz",
"integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==",
"version": "2.0.16",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz",
"integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==",
"dev": true
},
"colors": {
@ -2057,9 +2057,9 @@
"dev": true
},
"electron-to-chromium": {
"version": "1.3.853",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.853.tgz",
"integrity": "sha512-W4U8n+U8I5/SUaFcqZgbKRmYZwcyEIQVBDf+j5QQK6xChjXnQD+wj248eGR9X4u+dDmDR//8vIfbu4PrdBBIoQ==",
"version": "1.3.879",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.879.tgz",
"integrity": "sha512-zJo+D9GwbJvM31IdFmwcGvychhk4KKbKYo2GWlsn+C/dxz2NwmbhGJjWwTfFSF2+eFH7VvfA8MCZ8SOqTrlnpw==",
"dev": true
},
"emoji-regex": {
@ -2117,9 +2117,9 @@
"dev": true
},
"es-module-lexer": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.1.tgz",
"integrity": "sha512-17Ed9misDnpyNBJh63g1OhW3qUFecDgGOivI85JeZY/LGhDum8e+cltukbkSK8pcJnXXEkya56sp4vSS1nzoUw==",
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
"dev": true
},
"es6-error": {
@ -2178,9 +2178,9 @@
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true
}
}
@ -2253,9 +2253,9 @@
"dev": true
},
"signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
"dev": true
},
"which": {
@ -2792,9 +2792,9 @@
"dev": true
},
"import-local": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz",
"integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz",
"integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==",
"dev": true,
"requires": {
"pkg-dir": "^4.2.0",
@ -3156,9 +3156,9 @@
}
},
"jest-worker": {
"version": "27.2.3",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.2.3.tgz",
"integrity": "sha512-ZwOvv4GCIPviL+Ie4pVguz4N5w/6IGbTaHBYOl3ZcsZZktaL7d8JOU0rmovoED7AJZKA8fvmLbBg8yg80u/tGA==",
"version": "27.3.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.3.1.tgz",
"integrity": "sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==",
"dev": true,
"requires": {
"@types/node": "*",
@ -3585,9 +3585,9 @@
"dev": true
},
"marked": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz",
"integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==",
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz",
"integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==",
"dev": true
},
"medium-zoom": {
@ -3684,9 +3684,9 @@
}
},
"mocha": {
"version": "9.1.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz",
"integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==",
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz",
"integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==",
"dev": true,
"requires": {
"@ungap/promise-all-settled": "1.1.2",
@ -3829,16 +3829,10 @@
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"dev": true
},
"nanocolors": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.1.12.tgz",
"integrity": "sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==",
"dev": true
},
"nanoid": {
"version": "3.1.28",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.28.tgz",
"integrity": "sha512-gSu9VZ2HtmoKYe/lmyPFES5nknFrHa+/DT9muUFWFMi6Jh9E1I7bkvlQ8xxf1Kos9pi9o8lBnIOkatMhKX/YUw=="
"version": "3.1.30",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz",
"integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ=="
},
"neo-async": {
"version": "2.6.2",
@ -3881,9 +3875,9 @@
}
},
"node-releases": {
"version": "1.1.76",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz",
"integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz",
"integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==",
"dev": true
},
"normalize-path": {
@ -4403,6 +4397,12 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
"picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
"dev": true
},
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
@ -4655,14 +4655,14 @@
}
},
"replace-in-file": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-6.2.0.tgz",
"integrity": "sha512-Im2AF9G/qgkYneOc9QwWwUS/efyyonTUBvzXS2VXuxPawE5yQIjT/e6x4CTijO0Quq48lfAujuo+S89RR2TP2Q==",
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-6.3.2.tgz",
"integrity": "sha512-Dbt5pXKvFVPL3WAaEB3ZX+95yP0CeAtIPJDwYzHbPP5EAHn+0UoegH/Wg3HKflU9dYBH8UnBC2NvY3P+9EZtTg==",
"dev": true,
"requires": {
"chalk": "^4.1.0",
"glob": "^7.1.6",
"yargs": "^16.2.0"
"chalk": "^4.1.2",
"glob": "^7.2.0",
"yargs": "^17.2.1"
},
"dependencies": {
"ansi-styles": {
@ -4675,9 +4675,9 @@
}
},
"chalk": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
@ -4713,6 +4713,33 @@
"requires": {
"has-flag": "^4.0.0"
}
},
"y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true
},
"yargs": {
"version": "17.2.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.2.1.tgz",
"integrity": "sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==",
"dev": true,
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
}
},
"yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true
}
}
},
@ -4996,9 +5023,9 @@
}
},
"shiki": {
"version": "0.9.11",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz",
"integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==",
"version": "0.9.12",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.12.tgz",
"integrity": "sha512-VXcROdldv0/Qu0w2XvzU4IrvTeBNs/Kj/FCmtcEXGz7Tic/veQzliJj6tEiAgoKianhQstpYmbPDStHU5Opqcw==",
"dev": true,
"requires": {
"jsonc-parser": "^3.0.0",
@ -5167,6 +5194,46 @@
}
}
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.1"
}
}
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@ -5432,12 +5499,12 @@
}
},
"ts-node": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz",
"integrity": "sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==",
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
"dev": true,
"requires": {
"@cspotcode/source-map-support": "0.6.1",
"@cspotcode/source-map-support": "0.7.0",
"@tsconfig/node10": "^1.0.7",
"@tsconfig/node12": "^1.0.7",
"@tsconfig/node14": "^1.0.0",
@ -5593,22 +5660,22 @@
}
},
"typedoc": {
"version": "0.22.4",
"resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz",
"integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==",
"version": "0.22.7",
"resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.22.7.tgz",
"integrity": "sha512-ndxxp+tU1Wczvdxp4u2/PvT1qjD6hdFdSdehpORHjE+JXmMkl2bftXCR0upHmsnesBG7VCcr8vfgloGHIH8glQ==",
"dev": true,
"requires": {
"glob": "^7.1.7",
"glob": "^7.2.0",
"lunr": "^2.3.9",
"marked": "^3.0.4",
"marked": "^3.0.8",
"minimatch": "^3.0.4",
"shiki": "^0.9.11"
"shiki": "^0.9.12"
}
},
"typescript": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz",
"integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==",
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"dev": true
},
"unique-string": {
@ -5771,12 +5838,6 @@
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
"dev": true
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
@ -5805,9 +5866,9 @@
}
},
"webpack": {
"version": "5.55.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.55.1.tgz",
"integrity": "sha512-EYp9lwaOOAs+AA/KviNZ7bQiITHm4bXQvyTPewD2+f5YGjv6sfiClm40yeX5FgBMxh5bxcB6LryiFoP09B97Ug==",
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.60.0.tgz",
"integrity": "sha512-OL5GDYi2dKxnwJPSOg2tODgzDxAffN0osgWkZaBo/l3ikCxDFP+tuJT3uF7GyBE3SDBpKML/+a8EobyWAQO3DQ==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.0",
@ -5855,23 +5916,22 @@
}
},
"webpack-cli": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.8.0.tgz",
"integrity": "sha512-+iBSWsX16uVna5aAYN6/wjhJy1q/GKk4KjKvfg90/6hykCTSgozbfz5iRgDTSJt/LgSbYxdBX3KBHeobIs+ZEw==",
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz",
"integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==",
"dev": true,
"requires": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^1.0.4",
"@webpack-cli/info": "^1.3.0",
"@webpack-cli/serve": "^1.5.2",
"colorette": "^1.2.1",
"@webpack-cli/configtest": "^1.1.0",
"@webpack-cli/info": "^1.4.0",
"@webpack-cli/serve": "^1.6.0",
"colorette": "^2.0.14",
"commander": "^7.0.0",
"execa": "^5.0.0",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
"interpret": "^2.2.0",
"rechoir": "^0.7.0",
"v8-compile-cache": "^2.2.0",
"webpack-merge": "^5.7.3"
},
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "docx",
"version": "7.1.1",
"version": "7.1.2",
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
"main": "build/index.js",
"scripts": {
@ -95,7 +95,7 @@
"tslint": "^6.1.3",
"tslint-immutable": "^6.0.1",
"typedoc": "^0.22.3",
"typescript": "4.4.3",
"typescript": "4.4.4",
"unzipper": "^0.10.11",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"

View File

@ -12,7 +12,7 @@ describe("Packer", () => {
beforeEach(() => {
file = new File({
creator: "Dolan Miu",
revision: "1",
revision: 1,
lastModifiedBy: "Dolan Miu",
sections: [
{

View File

@ -38,7 +38,7 @@ describe("Properties", () => {
keywords: "test docx",
description: "testing document",
lastModifiedBy: "the author",
revision: "123",
revision: 123,
});
const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);

View File

@ -17,7 +17,7 @@ export interface IPropertiesOptions {
readonly keywords?: string;
readonly description?: string;
readonly lastModifiedBy?: string;
readonly revision?: string;
readonly revision?: number;
readonly externalStyles?: string;
readonly styles?: IStylesOptions;
readonly numbering?: INumberingOptions;
@ -89,7 +89,7 @@ export class CoreProperties extends XmlComponent {
this.root.push(new StringContainer("cp:lastModifiedBy", options.lastModifiedBy));
}
if (options.revision) {
this.root.push(new StringContainer("cp:revision", options.revision));
this.root.push(new StringContainer("cp:revision", String(options.revision)));
}
this.root.push(new TimestampElement("dcterms:created"));
this.root.push(new TimestampElement("dcterms:modified"));

View File

@ -57,7 +57,7 @@ export class File {
this.coreProperties = new CoreProperties({
...options,
creator: options.creator ?? "Un-named",
revision: options.revision ?? "1",
revision: options.revision ?? 1,
lastModifiedBy: options.lastModifiedBy ?? "Un-named",
});

View File

@ -1,7 +1,7 @@
import { XmlAttributeComponent } from "file/xml-components";
export class BookmarkStartAttributes extends XmlAttributeComponent<{
readonly id: string;
readonly id: number;
readonly name: string;
}> {
protected readonly xmlKeys = {
@ -11,7 +11,7 @@ export class BookmarkStartAttributes extends XmlAttributeComponent<{
}
export class BookmarkEndAttributes extends XmlAttributeComponent<{
readonly id: string;
readonly id: number;
}> {
protected readonly xmlKeys = {
id: "w:id",

View File

@ -36,6 +36,6 @@ describe("Bookmark", () => {
it("should create a bookmark with the correct attributes on the bookmark end element", () => {
const newJson = Utility.jsonify(bookmark);
expect(newJson.end.root[0].root.id).to.be.a("string");
expect(newJson.end.root[0].root.id).to.be.a("number");
});
});

View File

@ -1,5 +1,5 @@
// http://officeopenxml.com/WPbookmark.php
import { uniqueId } from "convenience-functions";
import { uniqueNumericId } from "convenience-functions";
import { XmlComponent } from "file/xml-components";
import { ParagraphChild } from "../paragraph";
@ -11,7 +11,7 @@ export class Bookmark {
public readonly end: BookmarkEnd;
constructor(options: { readonly id: string; readonly children: ParagraphChild[] }) {
const linkId = uniqueId();
const linkId = uniqueNumericId();
this.start = new BookmarkStart(options.id, linkId);
this.children = options.children;
@ -19,8 +19,40 @@ export class Bookmark {
}
}
// <xsd:element name="bookmarkStart" type="CT_Bookmark"/>
// <xsd:element name="bookmarkEnd" type="CT_MarkupRange"/>
// <xsd:complexType name="CT_Bookmark">
// <xsd:complexContent>
// <xsd:extension base="CT_BookmarkRange">
// <xsd:attribute name="name" type="s:ST_String" use="required"/>
// </xsd:extension>
// </xsd:complexContent>
// </xsd:complexType>
// <xsd:complexType name="CT_BookmarkRange">
// <xsd:complexContent>
// <xsd:extension base="CT_MarkupRange">
// <xsd:attribute name="colFirst" type="ST_DecimalNumber" use="optional"/>
// <xsd:attribute name="colLast" type="ST_DecimalNumber" use="optional"/>
// </xsd:extension>
// </xsd:complexContent>
// </xsd:complexType>
// <xsd:complexType name="CT_MarkupRange">
// <xsd:complexContent>
// <xsd:extension base="CT_Markup">
// <xsd:attribute name="displacedByCustomXml" type="ST_DisplacedByCustomXml" use="optional"/>
// </xsd:extension>
// </xsd:complexContent>
// </xsd:complexType>
// <xsd:complexType name="CT_Markup">
// <xsd:attribute name="id" type="ST_DecimalNumber" use="required"/>
// </xsd:complexType>
export class BookmarkStart extends XmlComponent {
constructor(id: string, linkId: string) {
constructor(id: string, linkId: number) {
super("w:bookmarkStart");
const attributes = new BookmarkStartAttributes({
@ -32,7 +64,7 @@ export class BookmarkStart extends XmlComponent {
}
export class BookmarkEnd extends XmlComponent {
constructor(linkId: string) {
constructor(linkId: number) {
super("w:bookmarkEnd");
const attributes = new BookmarkEndAttributes({

View File

@ -22,6 +22,9 @@ describe("Paragraph", () => {
stub(convenienceFunctions, "uniqueId").callsFake(() => {
return "test-unique-id";
});
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => {
return -101;
});
});
after(() => {
@ -716,7 +719,7 @@ describe("Paragraph", () => {
{
"w:bookmarkStart": {
_attr: {
"w:id": "test-unique-id",
"w:id": -101,
"w:name": "test-id",
},
},
@ -738,7 +741,7 @@ describe("Paragraph", () => {
{
"w:bookmarkEnd": {
_attr: {
"w:id": "test-unique-id",
"w:id": -101,
},
},
},