Compare commits
116 Commits
Author | SHA1 | Date | |
---|---|---|---|
56d23176b7 | |||
958538c96a | |||
9fa6d5392b | |||
d7fdbf9736 | |||
0af1279b1d | |||
2bb2333cb9 | |||
78c511cab9 | |||
4016e961a9 | |||
9f3888d94f | |||
316891a1f2 | |||
0a9d844dcc | |||
15b8d85562 | |||
d1f3df5600 | |||
0fc0921aa9 | |||
7ad4c5409c | |||
a645accf5d | |||
b64cb2d448 | |||
cfcea6c863 | |||
d1cd17ff6e | |||
408869fa96 | |||
ed146fbffd | |||
e49e1cc7b9 | |||
2c9233c021 | |||
b2ad04e4e7 | |||
2381ba8a05 | |||
9cff0b2a57 | |||
a4754ebcfe | |||
8988f471c3 | |||
5f4ff94e26 | |||
6f531c5abc | |||
c761a362d1 | |||
2e155ddebc | |||
9c8a07eadc | |||
9cb9c8c462 | |||
4268c9d466 | |||
26f77eb45f | |||
dea23e4349 | |||
0ade4b1557 | |||
165d48323b | |||
179598cc07 | |||
a8656ca3fe | |||
020e0eb669 | |||
e5dfce523a | |||
b53b4a77b4 | |||
dd86cf3d27 | |||
32953b3696 | |||
cfec058c9d | |||
a1c07d5a8e | |||
5be745b081 | |||
b4fcfd6386 | |||
6e371d42a7 | |||
e8564d58c6 | |||
368aa431a0 | |||
afcd1ae060 | |||
244d2b8904 | |||
6dae62e1ab | |||
5810cb5f02 | |||
11c26af3a9 | |||
1b9b815214 | |||
c342137c6f | |||
eefc8bd8a5 | |||
9873861210 | |||
cf7a05e05d | |||
6eb11d8842 | |||
3ad68337e7 | |||
07f363fcb7 | |||
2d2e4cdab2 | |||
0cadec7f58 | |||
e86dbd3398 | |||
021f1b0c4d | |||
5aa2027252 | |||
2fc297ef3c | |||
3fe216846c | |||
649a50f7c5 | |||
dc14123a5a | |||
048a035a5d | |||
f212cf0251 | |||
1f2f5988e1 | |||
f1359a4750 | |||
f2775ed13c | |||
3ae749278e | |||
0bcc6910f4 | |||
c15951550c | |||
8308b6413e | |||
5b75875684 | |||
28029f4c1c | |||
824d7f9893 | |||
b3aea4b9a0 | |||
32377d187d | |||
a80815822d | |||
c198154fdc | |||
618c7a8578 | |||
ef7b930d4d | |||
8296895cc6 | |||
1dce6fee15 | |||
444e7771b4 | |||
962795743c | |||
f98f852a55 | |||
e379a7fe04 | |||
022b25cfcd | |||
e20bd66663 | |||
6b8e22368b | |||
4304e82751 | |||
75715fde37 | |||
e779f6ea62 | |||
9280cdba50 | |||
8410d0c06d | |||
d47d85bdcf | |||
6ae45327fe | |||
464cd946dc | |||
cbff540b6e | |||
a8e6ba4c49 | |||
efc1ceaf1a | |||
c4ed19e589 | |||
13cf3eee5a | |||
24c159de37 |
@ -47,23 +47,28 @@ rules:
|
||||
"@typescript-eslint/array-type":
|
||||
- error
|
||||
- default: array
|
||||
"@typescript-eslint/ban-types":
|
||||
"@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":
|
||||
|
16
.github/workflows/default.yml
vendored
16
.github/workflows/default.yml
vendored
@ -13,10 +13,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- uses: "./.github/actions/install-and-build"
|
||||
- name: Archive Production Artifact
|
||||
uses: actions/upload-artifact@master
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build
|
||||
path: build
|
||||
@ -25,22 +25,24 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Test
|
||||
run: npm run test:ci
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Lint
|
||||
@ -50,7 +52,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Prettier
|
||||
@ -60,7 +62,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Prettier
|
||||
|
2
.github/workflows/demos.yml
vendored
2
.github/workflows/demos.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
name: Demos
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v4
|
||||
- uses: "./.github/actions/install-and-build"
|
||||
- name: Run Demos
|
||||
run: npm run run-ts -- ./demo/1-basic.ts
|
||||
|
8
.github/workflows/github-pages.yml
vendored
8
.github/workflows/github-pages.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Build 🔧
|
||||
@ -19,7 +19,7 @@ jobs:
|
||||
echo "docx.js.org" > docs/.nojekyll
|
||||
echo "docx.js.org" > docs/CNAME
|
||||
- name: Archive Production Artifact
|
||||
uses: actions/upload-artifact@master
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: docs
|
||||
@ -28,11 +28,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo 🛎️
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
run: npm ci --force
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@master
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: docs
|
||||
|
46
.github/workflows/npm-publish.yml
vendored
Normal file
46
.github/workflows/npm-publish.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# 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}}
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -5,5 +5,6 @@
|
||||
"editor.formatOnSave": false,
|
||||
"prettier.tabWidth": 4,
|
||||
"prettier.arrowParens": "always",
|
||||
"prettier.bracketSpacing": true
|
||||
"prettier.bracketSpacing": true,
|
||||
"eslint.useFlatConfig": true
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide
|
||||
[<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/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!
|
||||
|
||||
|
24
SECURITY.md
Normal file
24
SECURITY.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 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.
|
@ -21,6 +21,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "jpg",
|
||||
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
@ -37,6 +38,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "png",
|
||||
data: fs.readFileSync("./demo/images/dog.png").toString("base64"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
@ -53,6 +55,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "jpg",
|
||||
data: fs.readFileSync("./demo/images/cat.jpg"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
@ -73,6 +76,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "bmp",
|
||||
data: fs.readFileSync("./demo/images/parrots.bmp"),
|
||||
transformation: {
|
||||
width: 150,
|
||||
@ -88,6 +92,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "gif",
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -103,6 +108,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "gif",
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -124,6 +130,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "jpg",
|
||||
data: fs.readFileSync("./demo/images/cat.jpg"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -143,6 +150,22 @@ 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"),
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -21,6 +21,8 @@ import {
|
||||
Packer,
|
||||
Paragraph,
|
||||
TextRun,
|
||||
MathLimitLower,
|
||||
MathLimitUpper,
|
||||
} from "docx";
|
||||
|
||||
const doc = new Document({
|
||||
@ -316,6 +318,23 @@ 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")],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -16,7 +16,9 @@ import {
|
||||
VerticalAlign,
|
||||
} from "docx";
|
||||
|
||||
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||
patchDocument({
|
||||
outputType: "nodebuffer",
|
||||
data: fs.readFileSync("demo/assets/simple-template.docx"),
|
||||
patches: {
|
||||
name: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
@ -56,7 +58,11 @@ patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||
],
|
||||
link: "https://www.google.co.uk",
|
||||
}),
|
||||
new ImageRun({ data: fs.readFileSync("./demo/images/dog.png"), transformation: { width: 100, height: 100 } }),
|
||||
new ImageRun({
|
||||
type: "png",
|
||||
data: fs.readFileSync("./demo/images/dog.png"),
|
||||
transformation: { width: 100, height: 100 },
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
@ -82,7 +88,13 @@ patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||
},
|
||||
image_test: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new ImageRun({ data: fs.readFileSync("./demo/images/image1.jpeg"), transformation: { width: 100, height: 100 } })],
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "jpg",
|
||||
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
||||
transformation: { width: 100, height: 100 },
|
||||
}),
|
||||
],
|
||||
},
|
||||
table: {
|
||||
type: PatchType.DOCUMENT,
|
||||
|
@ -3,7 +3,9 @@
|
||||
import * as fs from "fs";
|
||||
import { patchDocument, PatchType, TextRun } from "docx";
|
||||
|
||||
patchDocument(fs.readFileSync("demo/assets/simple-template-2.docx"), {
|
||||
patchDocument({
|
||||
outputType: "nodebuffer",
|
||||
data: fs.readFileSync("demo/assets/simple-template-2.docx"),
|
||||
patches: {
|
||||
name: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
|
@ -24,7 +24,9 @@ const patches = getPatches({
|
||||
paragraph_replace: "Lorem ipsum paragraph",
|
||||
});
|
||||
|
||||
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
|
||||
patchDocument({
|
||||
outputType: "nodebuffer",
|
||||
data: fs.readFileSync("demo/assets/simple-template.docx"),
|
||||
patches,
|
||||
}).then((doc) => {
|
||||
fs.writeFileSync("My Document.docx", doc);
|
||||
|
@ -22,8 +22,11 @@ const patches = getPatches({
|
||||
"first-name": "John",
|
||||
});
|
||||
|
||||
patchDocument(fs.readFileSync("demo/assets/simple-template-3.docx"), {
|
||||
patchDocument({
|
||||
outputType: "nodebuffer",
|
||||
data: fs.readFileSync("demo/assets/simple-template-3.docx"),
|
||||
patches,
|
||||
keepOriginalStyles: true,
|
||||
}).then((doc) => {
|
||||
fs.writeFileSync("My Document.docx", doc);
|
||||
});
|
||||
|
72
demo/93-template-document.ts
Normal file
72
demo/93-template-document.ts
Normal file
@ -0,0 +1,72 @@
|
||||
// Patch a document with patches
|
||||
|
||||
import * as fs from "fs";
|
||||
import { patchDocument, PatchType, TextRun } from "docx";
|
||||
|
||||
patchDocument({
|
||||
outputType: "nodebuffer",
|
||||
data: fs.readFileSync("demo/assets/field-trip.docx"),
|
||||
patches: {
|
||||
todays_date: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: new Date().toLocaleDateString() })],
|
||||
},
|
||||
|
||||
school_name: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
address: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "blah blah" })],
|
||||
},
|
||||
|
||||
city: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
state: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
zip: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
phone: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
first_name: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
last_name: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
email_address: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
ft_dates: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
|
||||
grade: {
|
||||
type: PatchType.PARAGRAPH,
|
||||
children: [new TextRun({ text: "test" })],
|
||||
},
|
||||
},
|
||||
}).then((doc) => {
|
||||
fs.writeFileSync("My Document.docx", doc);
|
||||
});
|
BIN
demo/assets/field-trip.docx
Normal file
BIN
demo/assets/field-trip.docx
Normal file
Binary file not shown.
Binary file not shown.
BIN
demo/images/linux-png.png
Normal file
BIN
demo/images/linux-png.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
183
demo/images/linux-svg.svg
Normal file
183
demo/images/linux-svg.svg
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="500pt" height="600pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/">
|
||||
|
||||
<defs>
|
||||
|
||||
<linearGradient id="linearGradient172">
|
||||
|
||||
<stop style="stop-color:#3f2600;stop-opacity:0.6;" offset="0" id="stop173" />
|
||||
|
||||
<stop style="stop-color:#3f2600;stop-opacity:0;" offset="1" id="stop174" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient167">
|
||||
|
||||
<stop style="stop-color:#ffffff;stop-opacity:0.65;" offset="0" id="stop168" />
|
||||
|
||||
<stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop169" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient162">
|
||||
|
||||
<stop style="stop-color:#ffa63f;stop-opacity:1;" offset="0" id="stop163" />
|
||||
|
||||
<stop style="stop-color:#ffff00;stop-opacity:1;" offset="1" id="stop164" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient153">
|
||||
|
||||
<stop style="stop-color:#ffeed7;stop-opacity:1;" offset="0" id="stop154" />
|
||||
|
||||
<stop style="stop-color:#bdbfc2;stop-opacity:1;" offset="1" id="stop155" /></linearGradient>
|
||||
|
||||
<linearGradient id="linearGradient138">
|
||||
|
||||
<stop style="stop-color:#ffffff;stop-opacity:0.8;" offset="0" id="stop139" />
|
||||
|
||||
<stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop140" />
|
||||
</linearGradient>
|
||||
<linearGradient xlink:href="#linearGradient138" id="linearGradient141" x1="0.47424799" y1="0.020191999" x2="0.417539" y2="0.90125799" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient142" x1="0.55880702" y1="0.031192999" x2="0.553922" y2="0.94531101" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient143" x1="0.46557701" y1="0.028819799" x2="0.41365999" y2="0.93366498" gradientUnits="objectBoundingBox"/>
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient144" x1="0.70346397" y1="0.059404202" x2="0.64553201" y2="0.94063401" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient145" x1="0.46741399" y1="-0.036155298" x2="0.86741799" y2="0.75857902" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient146" x1="0.57152498" y1="0.023441499" x2="0.57143003" y2="0.71875" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient147" x1="0.5" y1="0.0234362" x2="0.5" y2="0.8125" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient148" x1="0.50799799" y1="0.37435901" x2="0.51599997" y2="0.92820501" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient138" id="linearGradient149" x1="0.5" y1="0.131707" x2="0.50400001" y2="0.94634098" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient150" x1="-0.30509499" y1="0.099496603" x2="0.156323" y2="0.94191301" gradientUnits="objectBoundingBox" gradientTransform="matrix(-0.928523,0.283938,0.435332,0.943857,-1.91327e-7,5.49908e-8)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient151" x1="0.433979" y1="0.022184599" x2="0.487055" y2="1.02569" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient152" x1="0.5" y1="0.89842999" x2="0.5" y2="0.40625" gradientUnits="objectBoundingBox" spreadMethod="reflect" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient156" x1="0.43568701" y1="0.98882002" x2="0.453989" y2="0.23093501" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient157" x1="0.49180499" y1="1.15284" x2="0.49482101" y2="0.41252401" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient158" x1="0.51730198" y1="0.85418499" x2="0.49843901" y2="0.136172" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient159" x1="0.46201" y1="0.87917101" x2="0.49215299" y2="0.096282303" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient161" x1="0.50086302" y1="0.34872901" x2="0.41209599" y2="0.98558098" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient165" x1="0.60399801" y1="0.51020199" x2="0.46399999" y2="0.98367399" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient166" x1="0.50000501" y1="0.191616" x2="0.50800002" y2="0.97005898" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<radialGradient xlink:href="#linearGradient172" id="radialGradient171" cx="0.5" cy="0.5" fx="0.5" fy="0.5" r="0.5" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<radialGradient xlink:href="#linearGradient172" id="radialGradient176" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient178" x1="0.94027299" y1="1.2934099" x2="0.19452" y2="-0.675295" gradientUnits="objectBoundingBox" />
|
||||
|
||||
<radialGradient xlink:href="#linearGradient172" id="radialGradient1399" gradientTransform="scale(1.045233,0.956725)" cx="446.77762" cy="1219.4125" fx="446.77762" fy="1219.4125" r="195.07191" gradientUnits="userSpaceOnUse" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1401" gradientUnits="userSpaceOnUse" x1="400.57785" y1="369.53015" x2="400.84448" y2="304.07886" gradientTransform="scale(0.575262,1.738339)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient138" id="linearGradient1403" gradientUnits="userSpaceOnUse" x1="303.01761" y1="237.93179" x2="297.0856" y2="330.09561" gradientTransform="scale(1.116071,0.896001)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1405" gradientUnits="userSpaceOnUse" gradientTransform="scale(0.816497,1.224744)" x1="378.93771" y1="278.60202" x2="380.27319" y2="243.91606" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1407" gradientUnits="userSpaceOnUse" x1="381.38742" y1="277.495" x2="380.5517" y2="245.68338" gradientTransform="scale(0.816497,1.224744)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1409" gradientUnits="userSpaceOnUse" gradientTransform="scale(0.816497,1.224744)" x1="379.09573" y1="240.92712" x2="376.79556" y2="281.01636" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1411" gradientUnits="userSpaceOnUse" x1="389.63535" y1="242.28218" x2="387.06866" y2="281.32513" gradientTransform="scale(0.816497,1.224744)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1413" gradientUnits="userSpaceOnUse" spreadMethod="reflect" x1="437.57941" y1="528.87177" x2="437.57941" y2="394.10361" gradientTransform="scale(0.812855,1.230232)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1415" gradientUnits="userSpaceOnUse" x1="375.17325" y1="419.78485" x2="377.48541" y2="324.03815" gradientTransform="scale(0.649784,1.538974)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient138" id="linearGradient1417" gradientUnits="userSpaceOnUse" x1="320.75104" y1="498.17776" x2="321.32224" y2="614.50439" gradientTransform="scale(1.074798,0.930408)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1419" gradientUnits="userSpaceOnUse" x1="322.48257" y1="435.26761" x2="323.2514" y2="488.48251" gradientTransform="scale(1.077001,0.928504)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1421" gradientUnits="userSpaceOnUse" x1="411.2215" y1="242.94365" x2="411.2215" y2="331.44858" gradientTransform="scale(0.571707,1.749147)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1423" gradientUnits="userSpaceOnUse" x1="867.34546" y1="234.73897" x2="867.33453" y2="314.83911" gradientTransform="scale(0.572667,1.746214)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient1425" gradientUnits="userSpaceOnUse" x1="236.25362" y1="657.11133" x2="212.5099" y2="737.41229" gradientTransform="scale(1.011514,0.988617)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient153" id="linearGradient1427" gradientUnits="userSpaceOnUse" x1="381.56607" y1="655.73102" x2="279.64313" y2="386.66583" gradientTransform="scale(1.065499,0.938527)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient1429" gradientUnits="userSpaceOnUse" x1="218.11714" y1="630.30475" x2="203.12654" y2="737.8537" gradientTransform="scale(1.009851,0.990245)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1431" gradientUnits="userSpaceOnUse" gradientTransform="scale(1.007724,0.992335)" x1="117.88966" y1="587.23602" x2="182.24524" y2="704.73077" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1433" gradientUnits="userSpaceOnUse" x1="223.10072" y1="570.41809" x2="230.53499" y2="710.97723" gradientTransform="scale(0.999504,1.000496)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1435" gradientUnits="userSpaceOnUse" x1="316.93988" y1="474.01779" x2="371.60889" y2="582.63507" gradientTransform="scale(1.065499,0.938527)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient162" id="linearGradient1437" gradientUnits="userSpaceOnUse" x1="284.68652" y1="410.46326" x2="285.45923" y2="485.69934" gradientTransform="scale(1.218684,0.820557)" />
|
||||
|
||||
<linearGradient xlink:href="#linearGradient167" id="linearGradient1439" gradientUnits="userSpaceOnUse" x1="288.82358" y1="398.85422" x2="288.37628" y2="482.55939" gradientTransform="scale(1.221941,0.81837)" />
|
||||
</defs>
|
||||
|
||||
<g id="g1369" transform="translate(-310.7524,-64.25268)">
|
||||
|
||||
<path transform="matrix(1.4177,0,0,0.414745,-38.7944,222.194)" d="M 670.88202 1166.6423 A 203.89551 186.63016 0 1 1 263.091,1166.6423 A 203.89551 186.63016 0 1 1 670.88202 1166.6423 z" id="path175" style="fill:url(#radialGradient1399);stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path106" d="M 223.627,632.24 C 201.239,600.017 196.873,495.256 249.114,430.81 C 275,399.892 281.604,378.345 283.645,349.417 C 285.034,316.438 260.32,217.975 353.528,210.473 C 447.934,202.941 442.864,296.133 442.321,345.448 C 441.87,387.088 472.895,410.689 494.117,443.143 C 533.396,502.773 530.074,605.443 486.718,661.015 C 431.801,730.583 384.765,700.413 353.528,702.945 C 295.035,706.147 293.101,737.336 223.627,632.24 z " style="fill:#000000;stroke:none;stroke-width:1.25;" />
|
||||
|
||||
<path transform="matrix(-1.67739,-2.24516e-2,-2.11236e-2,1.4709,1173.58,-293.017)" id="path113" d="M 246.571,470.864 C 234.332,483.36 202.175,539.956 251.44,576.224 C 268.809,588.857 235.063,635.719 219.435,612.532 C 191.865,570.914 210.604,505.591 227.75,482.344 C 239.402,465.857 256.98,459.668 246.571,470.864 z " style="fill:url(#linearGradient1401);stroke:none;stroke-width:0.99464899;" />
|
||||
|
||||
<path transform="matrix(-1.67755,0,0,1.52374,1174.62,-318.082)" id="path111" d="M 256.513,459.837 C 236.598,477.554 200.337,539.928 253.225,580.443 C 270.595,593.075 237.832,632.906 219.435,612.532 C 155.472,541.712 221.104,460.278 243.697,432.282 C 263.889,407.935 281.775,438.034 256.513,459.837 z " style="fill:#000000;stroke:#000000;stroke-width:0.97729802;" />
|
||||
|
||||
<path transform="matrix(1.26626,-7.13667e-2,-4.59795e-2,1.19574,202.143,-125.761)" d="M 399.56879 258.15753 A 58.37323 46.863022 0 1 1 282.82233,258.15753 A 58.37323 46.863022 0 1 1 399.56879 258.15753 z" id="path114" style="fill:url(#linearGradient1403);stroke:none;stroke-width:1.26498997;" />
|
||||
|
||||
<path transform="matrix(1.30445,-7.55326e-2,7.71251e-2,1.34257,144.757,-177.617)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path115" style="fill:url(#linearGradient1405);stroke:none;stroke-width:1.17873001;" />
|
||||
|
||||
<path transform="matrix(-1.81082,4.95107e-2,3.17324e-2,1.55333,1207.46,-284.777)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path116" style="fill:url(#linearGradient1407);stroke:none;stroke-width:0.93138498;" />
|
||||
|
||||
<path transform="matrix(-0.823196,-1.76123e-3,-1.82321e-2,0.852662,913.674,-37.9902)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path117" style="fill:#000000;stroke:none;stroke-width:1.86495996;" />
|
||||
|
||||
<path transform="matrix(0.59438,-7.22959e-2,6.88176e-2,0.705838,367.448,32.4186)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path118" style="fill:#000000;stroke:none;stroke-width:2.39814997;" />
|
||||
|
||||
<path transform="matrix(-0.480323,-3.6454e-2,-4.67935e-2,0.475606,813.496,87.0124)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path121" style="fill:url(#linearGradient1409);stroke:none;stroke-width:3.1916101;" />
|
||||
|
||||
<path transform="matrix(0.35691,-4.08211e-2,4.13232e-2,0.398544,449.334,114.991)" d="M 328.86324 320.64151 A 18.087479 27.131195 0 1 1 292.68828,320.64151 A 18.087479 27.131195 0 1 1 328.86324 320.64151 z" id="path122" style="fill:url(#linearGradient1411);stroke:none;stroke-width:4.12025976;" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-168.23)" id="path128" d="M 258.702,495.425 C 271.538,466.322 298.816,415.199 299.397,375.667 C 299.397,344.225 393.576,336.716 401.134,368.109 C 408.692,399.502 427.875,446.592 440.084,469.265 C 452.292,491.937 487.893,563.96 449.968,626.811 C 415.811,682.455 312.243,726.477 256.958,619.254 C 238.355,582.047 241.673,535.939 258.702,495.425 z " style="fill:url(#linearGradient1413);stroke:none;stroke-width:1.25;" />
|
||||
|
||||
<path transform="matrix(1.38936,-0.111074,0.102211,1.30214,108.413,-165.938)" id="path112" d="M 242.905,473.815 C 231.642,492.782 207.405,543.124 255.042,575.862 C 306.353,610.682 301.515,672.924 239.435,637.817 C 182.658,606.028 216.59,500.039 234.925,475.551 C 247.032,458.337 264.822,437.52 242.905,473.815 z " style="fill:url(#linearGradient1415);stroke:none;stroke-width:1.15804005;" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path109" d="M 256.513,449.72 C 239.048,478.228 197.136,545.533 253.225,580.443 C 328.794,626.798 307.398,673.154 238.426,631.417 C 141.317,573.153 226.601,455.801 265.557,411.079 C 310.001,360.879 274.111,420.166 256.513,449.72 z " style="fill:#000000;stroke:#000000;stroke-width:1.25;" />
|
||||
|
||||
<path id="path125" d="M 421.481,504.727 C 421.481,537.139 392.209,579.243 341.953,578.865 C 290.125,579.32 268.004,537.139 268.004,504.727 C 268.004,472.315 302.383,446.01 344.743,446.01 C 387.102,446.01 421.481,472.315 421.481,504.727 z " style="font-size:12px;fill:url(#linearGradient1417);stroke:none;stroke-width:1.23705006;stroke-dasharray:none" transform="matrix(1.30209,0,0,1.22525,170.042,-153.557)" />
|
||||
|
||||
<path id="path127" d="M 398.227,412.292 C 397.615,450.864 375.047,459.963 346.487,459.963 C 317.926,459.963 297.195,454.269 294.746,412.292 C 294.746,385.978 317.926,370.75 346.487,370.75 C 375.047,370.75 398.227,385.978 398.227,412.292 z " style="font-size:12px;fill:url(#linearGradient1419);stroke:none;stroke-width:1.38846004;stroke-dasharray:none" transform="matrix(1.1868,0,0,1.06708,210.623,-100.078)" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path129" d="M 234.285,456.475 C 252.001,429.479 289.3,388.111 241.262,462.288 C 202.311,523.331 226.859,562.561 239.518,573.327 C 276.045,605.889 274.484,627.676 245.913,610.533 C 184.288,573.907 197.078,512.285 234.285,456.475 z " style="fill:url(#linearGradient1421);stroke:none;stroke-width:1.25;" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path131" d="M 490.662,467.52 C 475.343,435.819 426.528,355.618 492.988,448.917 C 553.449,533.214 511.01,591.93 503.452,597.744 C 495.895,603.557 470.315,615.184 477.873,594.837 C 485.43,574.49 523.107,535.864 490.662,467.52 z " style="fill:url(#linearGradient1423);stroke:none;stroke-width:1.25;" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path132" d="M 220.915,716.921 C 180.473,695.505 121.663,721.045 143.013,662.855 C 147.289,649.617 136.638,629.847 143.594,616.929 C 151.733,601.231 169.174,604.72 179.639,594.255 C 189.957,583.364 196.498,564.606 215.683,567.513 C 234.867,570.42 247.628,593.974 261.027,622.742 C 270.91,643.38 305.968,672.406 303.677,695.5 C 300.981,731 260.65,737.69 220.915,716.921 z " style="fill:url(#linearGradient1425);stroke:#e68c3f;stroke-width:6.25;" />
|
||||
|
||||
<path id="path177" d="M 415.072,495.764 C 412.065,520.67 379.259,572.391 345.554,577.298 C 311.294,582.634 279.122,543.238 271.407,506.184 C 261.518,464.978 293.994,448.584 343.345,449.557 C 396.646,451.211 417.466,463.448 415.072,495.764 z " style="font-size:12px;fill:url(#linearGradient1427);stroke:none;stroke-width:2.85509992;stroke-dasharray:none" transform="matrix(0.598206,0.268584,-0.239623,0.617213,700.568,140.464)" />
|
||||
|
||||
<path transform="matrix(-1.1685,0.423145,0.475283,1.16478,728.343,-213.821)" id="path133" d="M 220.274,718.402 C 178.947,694.812 120.38,724.007 143.013,662.855 C 147.749,649.787 136.417,629.303 143.373,616.385 C 151.512,600.687 169.174,604.72 179.639,594.255 C 189.957,583.364 198.466,566.387 217.651,569.294 C 236.835,572.201 247.628,593.974 261.027,622.742 C 270.91,643.38 304.442,671.713 302.151,694.807 C 299.455,730.307 259.427,740.278 220.274,718.402 z " style="fill:url(#linearGradient1429);stroke:#e68c3f;stroke-width:6.25067997;" />
|
||||
|
||||
<path transform="matrix(-0.945096,0.343745,0.424076,0.956058,714.328,-64.342)" id="path134" d="M 216.482,675.68 C 129.951,618.177 169.174,604.72 179.639,594.255 C 189.957,583.364 198.466,566.387 217.651,569.294 C 236.835,572.201 247.628,593.974 261.027,622.742 C 270.91,643.38 304.087,671.66 302.151,694.807 C 299.535,721.917 253.961,700.294 216.482,675.68 z " style="fill:url(#linearGradient1431);stroke:none;stroke-width:1.52532005;" />
|
||||
|
||||
<path transform="matrix(1.00431,-5.2286e-2,-1.74e-2,1.04575,244.191,-28.4653)" id="path135" d="M 216.506,677.071 C 129.975,619.568 169.709,603.501 182.56,595.791 C 197.959,585.849 197.718,564.96 216.903,567.867 C 236.087,570.774 247.628,593.974 261.027,622.742 C 270.91,643.38 304.087,671.66 302.151,694.807 C 299.535,721.917 253.985,701.685 216.506,677.071 z " style="fill:url(#linearGradient1433);stroke:none;stroke-width:1.52532005;" />
|
||||
|
||||
<path id="path136" d="M 415.072,495.764 C 412.065,520.67 379.259,572.391 345.554,577.298 C 311.294,582.634 279.122,543.238 271.407,506.184 C 261.518,464.978 293.994,448.584 343.345,449.557 C 396.646,451.211 417.466,463.448 415.072,495.764 z " style="font-size:12px;fill:#000000;stroke:none;stroke-width:2.85509992;" transform="matrix(0.515584,0.215259,-0.206526,0.49467,713.3,222.559)" />
|
||||
|
||||
<path id="path137" d="M 415.072,495.764 C 412.065,520.67 379.259,572.391 345.554,577.298 C 311.294,582.634 279.122,543.238 271.407,506.184 C 261.518,464.978 293.994,448.584 343.345,449.557 C 396.646,451.211 417.466,463.448 415.072,495.764 z " style="font-size:12px;fill:url(#linearGradient1435);stroke:none;stroke-width:2.85509992;" transform="matrix(0.351231,0.149463,-0.128856,0.343469,724.522,318.291)" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path119" d="M 309.954,338.729 C 317.101,331.959 334.765,311.663 367.915,332.974 C 374.077,336.984 379.077,337.351 390.936,342.429 C 414.662,352.178 403.318,375.688 378.192,383.537 C 367.434,387.026 357.656,400.093 338.063,398.976 C 321.329,397.999 316.944,387.102 306.665,381.07 C 288.396,370.759 285.7,356.816 295.565,349.417 C 305.431,342.018 309.29,339.358 309.954,338.729 z " style="fill:url(#linearGradient1437);stroke:#e68c3f;stroke-width:3.75;" />
|
||||
|
||||
<path transform="matrix(1.25,0,0,1.25,185.454,-167.505)" id="path120" d="M 391.251,357.645 C 381.368,358.226 359.858,379.736 337.185,379.736 C 314.512,379.736 301.141,358.807 297.653,358.807" style="fill:none;stroke:#e68c3f;stroke-width:2.5;" />
|
||||
|
||||
<path transform="matrix(0.627885,0,0,0.595666,392.366,51.8173)" id="path123" d="M 309.954,338.729 C 317.101,331.959 339.645,313.381 369.542,332.401 C 375.841,336.167 382.346,340.266 392.02,345.865 C 411.182,357.613 401.691,374.543 378.734,385.255 C 368.316,389.75 351.141,399.67 338.063,398.976 C 323.53,397.568 314.128,387.577 304.496,381.07 C 286.826,368.767 287.899,358.833 296.107,350.562 C 302.312,344.883 309.29,339.358 309.954,338.729 z " style="fill:url(#linearGradient1439);stroke:none;" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 21 KiB |
@ -4,7 +4,7 @@
|
||||
|
||||
- Simple, declarative API
|
||||
- 80+ usage examples
|
||||
- Battle tested, mature, 99.9%+ coverage
|
||||
- Battle tested, mature, 100% coverage (yes, every line is tested)
|
||||
|
||||
[GitHub](https://github.com/dolanmiu/docx)
|
||||
[Get Started](#Welcome)
|
||||
|
@ -22,7 +22,7 @@ const doc = new Document({
|
||||
}
|
||||
})
|
||||
],
|
||||
}];
|
||||
}]
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -6,6 +6,7 @@ To create a `floating` image on top of text:
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'gif',
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -26,6 +27,7 @@ By default with no arguments, its an `inline` image:
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'gif',
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
@ -59,6 +61,7 @@ const doc = new Document({
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: [IMAGE_TYPE],
|
||||
data: [IMAGE_BUFFER],
|
||||
transformation: {
|
||||
width: [IMAGE_SIZE],
|
||||
@ -97,6 +100,7 @@ To change the position the image to be on top of the text, simply add the `float
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'png',
|
||||
data: buffer,
|
||||
transformation: {
|
||||
width: 903,
|
||||
@ -115,6 +119,7 @@ const image = new ImageRun({
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'png',
|
||||
data: buffer,
|
||||
transformation: {
|
||||
width: 903,
|
||||
@ -180,6 +185,7 @@ For example:
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'gif',
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -228,6 +234,7 @@ For example:
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'gif',
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
transformation: {
|
||||
width: 200,
|
||||
@ -258,6 +265,7 @@ Specifies common non-visual DrawingML properties. A name, title and description
|
||||
|
||||
```ts
|
||||
const image = new ImageRun({
|
||||
type: 'gif',
|
||||
data: fs.readFileSync("./demo/images/pizza.gif"),
|
||||
altText: {
|
||||
title: "This is an ultimate title",
|
||||
|
@ -263,3 +263,23 @@ new MathAngledBrackets({
|
||||
],
|
||||
}),
|
||||
```
|
||||
|
||||
### Limit
|
||||
|
||||
#### Limit Upper
|
||||
|
||||
```ts
|
||||
new MathLimitUpper({
|
||||
children: [new MathRun("x")],
|
||||
limit: [new MathRun("-")],
|
||||
}),
|
||||
```
|
||||
|
||||
#### Limit Lower
|
||||
|
||||
```ts
|
||||
new MathLimitLower({
|
||||
children: [new MathRun("lim")],
|
||||
limit: [new MathRun("x→0")],
|
||||
}),
|
||||
```
|
||||
|
@ -130,6 +130,62 @@ new Paragraph({
|
||||
}),
|
||||
```
|
||||
|
||||
## Disabling numbering inherited from paragraph style
|
||||
|
||||
If the numbering is set on a paragraph style, you may wish to disable it for a specific paragraph:
|
||||
|
||||
```ts
|
||||
const doc = new Document({
|
||||
...
|
||||
numbering: {
|
||||
config: [
|
||||
{
|
||||
reference: "my-bullet-points",
|
||||
levels: [
|
||||
{
|
||||
level: 0,
|
||||
format: LevelFormat.BULLET,
|
||||
text: "\u1F60",
|
||||
alignment: AlignmentType.LEFT,
|
||||
style: {
|
||||
paragraph: {
|
||||
indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
styles: {
|
||||
paragraphStyles: [
|
||||
{
|
||||
id: 'bullet',
|
||||
name: 'Bullet',
|
||||
basedOn: 'Normal',
|
||||
next: 'Normal',
|
||||
run: {},
|
||||
paragraph: {
|
||||
numbering: {
|
||||
reference: 'my-bullet-points',
|
||||
level: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
```ts
|
||||
new Paragraph({
|
||||
text: "No bullet points!",
|
||||
style: "Bullet",
|
||||
numbering: false,
|
||||
}),
|
||||
```
|
||||
|
||||
## Full Example
|
||||
|
||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/3-numbering-and-bullet-points.ts ":include")
|
||||
|
@ -35,6 +35,9 @@ interface Patch {
|
||||
| type | `PatchType` | Required | `DOCUMENT`, `PARAGRAPH` |
|
||||
| children | `FileChild[] or ParagraphChild[]` | Required | The contents to replace with. A `FileChild` is a `Paragraph` or `Table`, whereas a `ParagraphChild` is typical `Paragraph` children. |
|
||||
|
||||
|
||||
The patcher also takes in a `keepOriginalStyles` boolean, which will preserve the styles of the patched text when set to true.
|
||||
|
||||
### How to patch existing document
|
||||
|
||||
1. Open your existing word document in your favorite Word Processor
|
||||
@ -76,7 +79,7 @@ patchDocument(fs.readFileSync("My Document.docx"), {
|
||||
],
|
||||
link: "https://www.google.co.uk",
|
||||
}),
|
||||
new ImageRun({ data: fs.readFileSync("./demo/images/dog.png"), transformation: { width: 100, height: 100 } }),
|
||||
new ImageRun({ type: 'png', data: fs.readFileSync("./demo/images/dog.png"), transformation: { width: 100, height: 100 } }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
|
@ -126,10 +126,10 @@ const doc = new Document({
|
||||
next: "Normal",
|
||||
quickFormat: true,
|
||||
run: {
|
||||
size: 26
|
||||
size: 26,
|
||||
bold: true,
|
||||
color: "999999",
|
||||
{
|
||||
underline: {
|
||||
type: UnderlineType.DOUBLE,
|
||||
color: "FF0000",
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ Then add the table in the `section`
|
||||
const doc = new Document({
|
||||
sections: [{
|
||||
children: [table],
|
||||
}];
|
||||
}],
|
||||
});
|
||||
```
|
||||
|
||||
|
370
eslint.config.ts
Normal file
370
eslint.config.ts
Normal file
@ -0,0 +1,370 @@
|
||||
import eslint from "@eslint/js";
|
||||
import type { Linter } from "eslint";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
import unicorn from "eslint-plugin-unicorn";
|
||||
import jsdoc from "eslint-plugin-jsdoc";
|
||||
import preferArrow from "eslint-plugin-prefer-arrow";
|
||||
import functional from "eslint-plugin-functional";
|
||||
import globals from "globals";
|
||||
import tsEslint from "typescript-eslint";
|
||||
|
||||
const config: Linter.Config<Linter.RulesRecord>[] = [
|
||||
{
|
||||
ignores: ["**/vite.config.ts", "**/build/**", "**/coverage/**", "**/*.js", "eslint.config.ts", "**/demo/**", "**/scripts/**"],
|
||||
},
|
||||
eslint.configs.recommended,
|
||||
importPlugin.flatConfigs.recommended,
|
||||
...tsEslint.configs.recommended,
|
||||
...tsEslint.configs.stylistic,
|
||||
{
|
||||
files: ["**/src/**/*.ts"],
|
||||
plugins: {
|
||||
unicorn,
|
||||
jsdoc,
|
||||
"prefer-arrow": preferArrow,
|
||||
functional,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
typescript: true,
|
||||
node: 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"],
|
||||
|
||||
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/consistent-type-definitions": ["error", "type"],
|
||||
|
||||
"@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/no-inferrable-types": "off",
|
||||
|
||||
"@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",
|
||||
"sort-imports": [
|
||||
"error",
|
||||
{
|
||||
allowSeparatedGroups: true,
|
||||
ignoreDeclarationSort: true,
|
||||
},
|
||||
],
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
groups: [["external", "builtin"], "internal", ["sibling", "parent", "index"]],
|
||||
"newlines-between": "always",
|
||||
pathGroups: [
|
||||
{ pattern: "@file/**/*", group: "internal" },
|
||||
{ pattern: "@file/**", group: "internal" },
|
||||
{ pattern: "@export/**", group: "internal" },
|
||||
],
|
||||
pathGroupsExcludedImportTypes: ["internal"],
|
||||
alphabetize: {
|
||||
order: "asc",
|
||||
caseInsensitive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
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-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",
|
||||
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^[_]+$",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["**/*.spec.ts"],
|
||||
plugins: {
|
||||
unicorn,
|
||||
jsdoc,
|
||||
"prefer-arrow": preferArrow,
|
||||
functional,
|
||||
},
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
|
||||
sourceType: "module",
|
||||
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
project: ["tsconfig.json"],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/no-unused-expressions": "off",
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"prefer-destructuring": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^[_]+$",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default config;
|
12815
package-lock.json
generated
12815
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docx",
|
||||
"version": "8.5.0",
|
||||
"version": "9.0.2",
|
||||
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
|
||||
"type": "module",
|
||||
"main": "build/index.umd.js",
|
||||
@ -22,7 +22,7 @@
|
||||
"test": "vitest --ui --coverage",
|
||||
"test:ci": "vitest run --coverage",
|
||||
"prepublishOnly": "npm run build --omit=dev",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint": "eslint --flag unstable_ts_config --config eslint.config.ts",
|
||||
"predemo": "npm run build",
|
||||
"demo": "tsx ./demo/index.ts",
|
||||
"typedoc": "typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
|
||||
@ -54,7 +54,8 @@
|
||||
"clippy"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/node": "^20.3.1",
|
||||
"@types/node": "^22.7.5",
|
||||
"hash.js": "^1.1.7",
|
||||
"jszip": "^3.10.1",
|
||||
"nanoid": "^5.0.4",
|
||||
"xml": "^1.0.1",
|
||||
@ -67,38 +68,43 @@
|
||||
},
|
||||
"homepage": "https://docx.js.org",
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.1",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/inquirer": "^9.0.3",
|
||||
"@types/prompt": "^1.1.1",
|
||||
"@types/unzipper": "^0.10.4",
|
||||
"@types/xml": "^1.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
||||
"@typescript-eslint/parser": "^6.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
||||
"@typescript-eslint/parser": "^8.8.1",
|
||||
"@vitest/coverage-v8": "^1.1.0",
|
||||
"@vitest/ui": "^1.1.0",
|
||||
"@vitest/ui": "^2.1.2",
|
||||
"cspell": "^8.2.3",
|
||||
"docsify-cli": "^4.3.0",
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-plugin-functional": "^6.0.0",
|
||||
"eslint": "^9.13.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-functional": "^7.0.2",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-jsdoc": "^46.2.6",
|
||||
"eslint-plugin-jsdoc": "^50.3.1",
|
||||
"eslint-plugin-no-null": "^1.0.2",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-unicorn": "^50.0.1",
|
||||
"execa": "^8.0.1",
|
||||
"glob": "^10.2.7",
|
||||
"inquirer": "^9.2.7",
|
||||
"jsdom": "^23.0.1",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"execa": "^9.4.0",
|
||||
"glob": "^11.0.0",
|
||||
"inquirer": "^12.0.0",
|
||||
"jiti": "^2.3.3",
|
||||
"jsdom": "^25.0.1",
|
||||
"pre-commit": "^1.2.2",
|
||||
"prettier": "^3.1.1",
|
||||
"tsconfig-paths": "^4.0.0",
|
||||
"tsx": "^4.7.0",
|
||||
"typedoc": "^0.25.4",
|
||||
"typedoc": "^0.26.9",
|
||||
"typescript": "5.3.3",
|
||||
"unzipper": "^0.10.11",
|
||||
"typescript-eslint": "^8.10.0",
|
||||
"unzipper": "^0.12.3",
|
||||
"vite": "^5.0.10",
|
||||
"vite-plugin-dts": "^3.3.1",
|
||||
"vite-plugin-node-polyfills": "^0.19.0",
|
||||
"vite-tsconfig-paths": "^4.2.0",
|
||||
"vite-plugin-dts": "^4.2.4",
|
||||
"vite-plugin-node-polyfills": "^0.22.0",
|
||||
"vite-tsconfig-paths": "^5.0.1",
|
||||
"vitest": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseXmlComponent, IContext, IXmlableObject } from "@file/xml-components";
|
||||
|
||||
export class Formatter {
|
||||
// tslint:disable-next-line: no-object-literal-type-assertion
|
||||
public format(input: BaseXmlComponent, context: IContext = { stack: [] } as unknown as IContext): IXmlableObject {
|
||||
const output = input.prepForXml(context);
|
||||
|
||||
|
@ -12,7 +12,8 @@ describe("ImageReplacer", () => {
|
||||
"test {test-image.png} test",
|
||||
[
|
||||
{
|
||||
stream: Buffer.from(""),
|
||||
type: "png",
|
||||
data: Buffer.from(""),
|
||||
fileName: "test-image.png",
|
||||
transformation: {
|
||||
pixels: {
|
||||
|
@ -125,7 +125,6 @@ describe("Compiler", () => {
|
||||
],
|
||||
});
|
||||
|
||||
// tslint:disable-next-line: no-string-literal
|
||||
const spy = vi.spyOn(compiler["formatter"], "format");
|
||||
|
||||
compiler.compile(file);
|
||||
@ -150,12 +149,25 @@ describe("Compiler", () => {
|
||||
new Paragraph({
|
||||
children: [
|
||||
new ImageRun({
|
||||
type: "png",
|
||||
data: Buffer.from("", "base64"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
height: 100,
|
||||
},
|
||||
}),
|
||||
new ImageRun({
|
||||
type: "svg",
|
||||
data: Buffer.from("", "base64"),
|
||||
transformation: {
|
||||
width: 100,
|
||||
height: 100,
|
||||
},
|
||||
fallback: {
|
||||
type: "png",
|
||||
data: Buffer.from("", "base64"),
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
@ -165,7 +177,8 @@ describe("Compiler", () => {
|
||||
|
||||
vi.spyOn(compiler["imageReplacer"], "getMediaData").mockReturnValue([
|
||||
{
|
||||
stream: Buffer.from(""),
|
||||
type: "png",
|
||||
data: Buffer.from(""),
|
||||
fileName: "test",
|
||||
transformation: {
|
||||
pixels: {
|
||||
@ -178,6 +191,36 @@ describe("Compiler", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "svg",
|
||||
data: Buffer.from(""),
|
||||
fileName: "test",
|
||||
transformation: {
|
||||
pixels: {
|
||||
x: 100,
|
||||
y: 100,
|
||||
},
|
||||
emus: {
|
||||
x: 100,
|
||||
y: 100,
|
||||
},
|
||||
},
|
||||
fallback: {
|
||||
type: "png",
|
||||
data: Buffer.from(""),
|
||||
fileName: "test",
|
||||
transformation: {
|
||||
pixels: {
|
||||
x: 100,
|
||||
y: 100,
|
||||
},
|
||||
emus: {
|
||||
x: 100,
|
||||
y: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
compiler.compile(file);
|
||||
|
@ -9,12 +9,12 @@ import { ImageReplacer } from "./image-replacer";
|
||||
import { NumberingReplacer } from "./numbering-replacer";
|
||||
import { PrettifyType } from "./packer";
|
||||
|
||||
interface IXmlifyedFile {
|
||||
type IXmlifyedFile = {
|
||||
readonly data: string;
|
||||
readonly path: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface IXmlifyedFileMapping {
|
||||
type IXmlifyedFileMapping = {
|
||||
readonly Document: IXmlifyedFile;
|
||||
readonly Styles: IXmlifyedFile;
|
||||
readonly Properties: IXmlifyedFile;
|
||||
@ -34,7 +34,7 @@ interface IXmlifyedFileMapping {
|
||||
readonly Comments?: IXmlifyedFile;
|
||||
readonly FontTable?: IXmlifyedFile;
|
||||
readonly FontTableRelationships?: IXmlifyedFile;
|
||||
}
|
||||
};
|
||||
|
||||
export class Compiler {
|
||||
private readonly formatter: Formatter;
|
||||
@ -62,8 +62,13 @@ export class Compiler {
|
||||
}
|
||||
}
|
||||
|
||||
for (const { stream, fileName } of file.Media.Array) {
|
||||
zip.file(`word/media/${fileName}`, stream);
|
||||
for (const data of file.Media.Array) {
|
||||
if (data.type !== "svg") {
|
||||
zip.file(`word/media/${data.fileName}`, data.data);
|
||||
} else {
|
||||
zip.file(`word/media/${data.fileName}`, data.data);
|
||||
zip.file(`word/media/${data.fallback.fileName}`, data.fallback.data);
|
||||
}
|
||||
}
|
||||
|
||||
for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
|
||||
|
@ -139,7 +139,6 @@ describe("Packer", () => {
|
||||
it("should create a standard docx file", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.spyOn((Packer as any).compiler, "compile").mockReturnValue({
|
||||
// tslint:disable-next-line: no-empty
|
||||
generateAsync: () => vi.fn(),
|
||||
});
|
||||
const str = await Packer.toBlob(file);
|
||||
@ -167,7 +166,6 @@ describe("Packer", () => {
|
||||
it("should create a standard docx file", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.spyOn((Packer as any).compiler, "compile").mockReturnValue({
|
||||
// tslint:disable-next-line: no-empty
|
||||
generateAsync: () => Promise.resolve(vi.fn()),
|
||||
});
|
||||
const stream = Packer.toStream(file);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Stream } from "stream";
|
||||
|
||||
import { File } from "@file/file";
|
||||
|
||||
import { Compiler } from "./next-compiler";
|
||||
@ -10,7 +11,7 @@ export const PrettifyType = {
|
||||
NONE: "",
|
||||
WITH_2_BLANKS: " ",
|
||||
WITH_4_BLANKS: " ",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
||||
WITH_TAB: "\t",
|
||||
} as const;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { AppPropertiesAttributes } from "./app-properties-attributes";
|
||||
|
||||
export class AppProperties extends XmlComponent {
|
||||
|
@ -22,7 +22,7 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { eighthPointMeasureValue, hexColorValue, pointMeasureValue } from "@util/values";
|
||||
|
||||
export interface IBorderOptions {
|
||||
export type IBorderOptions = {
|
||||
readonly style: (typeof BorderStyle)[keyof typeof BorderStyle];
|
||||
/** Border color, in hex (eg 'FF00AA') */
|
||||
readonly color?: string;
|
||||
@ -30,7 +30,7 @@ export interface IBorderOptions {
|
||||
readonly size?: number;
|
||||
/** Spacing offset. Values are specified in pt */
|
||||
readonly space?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class BorderElement extends XmlComponent {
|
||||
public constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
|
||||
@ -55,7 +55,6 @@ class BordersAttributes extends XmlAttributeComponent<IBorderOptions> {
|
||||
};
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const BorderStyle = {
|
||||
SINGLE: "single",
|
||||
DASH_DOT_STROKED: "dashDotStroked",
|
||||
@ -85,4 +84,3 @@ export const BorderStyle = {
|
||||
TRIPLE: "triple",
|
||||
WAVE: "wave",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { CheckBoxUtil } from ".";
|
||||
|
||||
describe("CheckBoxUtil", () => {
|
||||
|
@ -7,20 +7,20 @@
|
||||
// </xsd:complexType>
|
||||
// <xsd:element name="checkbox" type="CT_SdtCheckbox"/>
|
||||
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
import { CheckBoxSymbolElement } from "@file/checkbox/checkbox-symbol";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export interface ICheckboxSymbolProperties {
|
||||
export type ICheckboxSymbolProperties = {
|
||||
readonly value?: string;
|
||||
readonly font?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface ICheckboxSymbolOptions {
|
||||
export type ICheckboxSymbolOptions = {
|
||||
readonly alias?: string;
|
||||
readonly checked?: boolean;
|
||||
readonly checkedState?: ICheckboxSymbolProperties;
|
||||
readonly uncheckedState?: ICheckboxSymbolProperties;
|
||||
}
|
||||
};
|
||||
|
||||
export class CheckBoxUtil extends XmlComponent {
|
||||
private readonly DEFAULT_UNCHECKED_SYMBOL: string = "2610";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { CheckBox } from "./checkbox";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { SymbolRun } from "@file/paragraph/run/symbol-run";
|
||||
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
|
||||
import { StructuredDocumentTagContent } from "@file/table-of-contents/sdt-content";
|
||||
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CheckBoxUtil, ICheckboxSymbolOptions } from "./checkbox-util";
|
||||
|
||||
export class CheckBox extends XmlComponent {
|
||||
|
@ -1,5 +1,3 @@
|
||||
// tslint:disable:no-string-literal
|
||||
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
@ -25,12 +23,13 @@ describe("ContentTypes", () => {
|
||||
expect(tree["Types"][3]).to.deep.equal({ Default: { _attr: { ContentType: "image/jpeg", Extension: "jpg" } } });
|
||||
expect(tree["Types"][4]).to.deep.equal({ Default: { _attr: { ContentType: "image/bmp", Extension: "bmp" } } });
|
||||
expect(tree["Types"][5]).to.deep.equal({ Default: { _attr: { ContentType: "image/gif", Extension: "gif" } } });
|
||||
expect(tree["Types"][6]).to.deep.equal({
|
||||
expect(tree["Types"][6]).to.deep.equal({ Default: { _attr: { ContentType: "image/svg+xml", Extension: "svg" } } });
|
||||
expect(tree["Types"][7]).to.deep.equal({
|
||||
Default: { _attr: { ContentType: "application/vnd.openxmlformats-package.relationships+xml", Extension: "rels" } },
|
||||
});
|
||||
expect(tree["Types"][7]).to.deep.equal({ Default: { _attr: { ContentType: "application/xml", Extension: "xml" } } });
|
||||
expect(tree["Types"][8]).to.deep.equal({ Default: { _attr: { ContentType: "application/xml", Extension: "xml" } } });
|
||||
|
||||
expect(tree["Types"][8]).to.deep.equal({
|
||||
expect(tree["Types"][9]).to.deep.equal({
|
||||
Default: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.obfuscatedFont",
|
||||
@ -38,7 +37,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][9]).to.deep.equal({
|
||||
expect(tree["Types"][10]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
|
||||
@ -46,7 +45,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][10]).to.deep.equal({
|
||||
expect(tree["Types"][11]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
|
||||
@ -54,7 +53,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][11]).to.deep.equal({
|
||||
expect(tree["Types"][12]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-package.core-properties+xml",
|
||||
@ -62,7 +61,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][12]).to.deep.equal({
|
||||
expect(tree["Types"][13]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.custom-properties+xml",
|
||||
@ -70,7 +69,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][13]).to.deep.equal({
|
||||
expect(tree["Types"][14]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
|
||||
@ -78,7 +77,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][14]).to.deep.equal({
|
||||
expect(tree["Types"][15]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
||||
@ -86,7 +85,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][15]).to.deep.equal({
|
||||
expect(tree["Types"][16]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",
|
||||
@ -94,7 +93,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(tree["Types"][16]).to.deep.equal({
|
||||
expect(tree["Types"][17]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
|
||||
@ -111,7 +110,7 @@ describe("ContentTypes", () => {
|
||||
contentTypes.addFooter(102);
|
||||
const tree = new Formatter().format(contentTypes);
|
||||
|
||||
expect(tree["Types"][19]).to.deep.equal({
|
||||
expect(tree["Types"][20]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
|
||||
@ -120,7 +119,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(tree["Types"][20]).to.deep.equal({
|
||||
expect(tree["Types"][21]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
|
||||
@ -137,7 +136,7 @@ describe("ContentTypes", () => {
|
||||
contentTypes.addHeader(202);
|
||||
const tree = new Formatter().format(contentTypes);
|
||||
|
||||
expect(tree["Types"][19]).to.deep.equal({
|
||||
expect(tree["Types"][20]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
||||
@ -146,7 +145,7 @@ describe("ContentTypes", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(tree["Types"][20]).to.deep.equal({
|
||||
expect(tree["Types"][21]).to.deep.equal({
|
||||
Override: {
|
||||
_attr: {
|
||||
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ContentTypeAttributes } from "./content-types-attributes";
|
||||
import { Default } from "./default/default";
|
||||
import { Override } from "./override/override";
|
||||
@ -18,6 +19,7 @@ export class ContentTypes extends XmlComponent {
|
||||
this.root.push(new Default("image/jpeg", "jpg"));
|
||||
this.root.push(new Default("image/bmp", "bmp"));
|
||||
this.root.push(new Default("image/gif", "gif"));
|
||||
this.root.push(new Default("image/svg+xml", "svg"));
|
||||
this.root.push(new Default("application/vnd.openxmlformats-package.relationships+xml", "rels"));
|
||||
this.root.push(new Default("application/xml", "xml"));
|
||||
this.root.push(new Default("application/vnd.openxmlformats-officedocument.obfuscatedFont", "odttf"));
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { DefaultAttributes } from "./default-attributes";
|
||||
|
||||
export class Default extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { OverrideAttributes } from "./override-attributes";
|
||||
|
||||
export class Override extends XmlComponent {
|
||||
|
@ -45,7 +45,7 @@ describe("Properties", () => {
|
||||
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const key = (obj: { readonly [key: string]: any }) => Object.keys(obj)[0];
|
||||
const key = (obj: Readonly<Record<string, any>>) => Object.keys(obj)[0];
|
||||
expect(tree["cp:coreProperties"].map(key)).to.include.members([
|
||||
"_attr",
|
||||
"cp:keywords",
|
||||
|
@ -1,19 +1,18 @@
|
||||
import { FontOptions } from "@file/fonts/font-table";
|
||||
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
|
||||
import { ICompatibilityOptions } from "@file/settings/compatibility";
|
||||
import { FontOptions } from "@file/fonts/font-table";
|
||||
import { StringContainer, XmlComponent } from "@file/xml-components";
|
||||
import { dateTimeValue } from "@util/values";
|
||||
|
||||
import { ICustomPropertyOptions } from "../custom-properties";
|
||||
import { IDocumentBackgroundOptions } from "../document";
|
||||
|
||||
import { DocumentAttributes } from "../document/document-attributes";
|
||||
import { ISectionOptions } from "../file";
|
||||
import { INumberingOptions } from "../numbering";
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { IStylesOptions } from "../styles";
|
||||
|
||||
export interface IPropertiesOptions {
|
||||
export type IPropertiesOptions = {
|
||||
readonly sections: readonly ISectionOptions[];
|
||||
readonly title?: string;
|
||||
readonly subject?: string;
|
||||
@ -26,11 +25,14 @@ export interface IPropertiesOptions {
|
||||
readonly styles?: IStylesOptions;
|
||||
readonly numbering?: INumberingOptions;
|
||||
readonly comments?: ICommentsOptions;
|
||||
readonly footnotes?: {
|
||||
readonly [key: string]: {
|
||||
readonly footnotes?: Readonly<
|
||||
Record<
|
||||
string,
|
||||
{
|
||||
readonly children: readonly Paragraph[];
|
||||
};
|
||||
};
|
||||
}
|
||||
>
|
||||
>;
|
||||
readonly background?: IDocumentBackgroundOptions;
|
||||
readonly features?: {
|
||||
readonly trackRevisions?: boolean;
|
||||
@ -42,7 +44,7 @@ export interface IPropertiesOptions {
|
||||
readonly evenAndOddHeaderAndFooters?: boolean;
|
||||
readonly defaultTabStop?: number;
|
||||
readonly fonts?: readonly FontOptions[];
|
||||
}
|
||||
};
|
||||
|
||||
// <xs:element name="coreProperties" type="CT_CoreProperties"/>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CustomPropertiesAttributes } from "./custom-properties-attributes";
|
||||
import { CustomProperty, ICustomPropertyOptions } from "./custom-property";
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CustomPropertyAttributes } from "./custom-property-attributes";
|
||||
|
||||
export interface ICustomPropertyOptions {
|
||||
export type ICustomPropertyOptions = {
|
||||
readonly name: string;
|
||||
readonly value: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class CustomProperty extends XmlComponent {
|
||||
public constructor(id: number, properties: ICustomPropertyOptions) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { XmlComponent } from "./xml-components";
|
||||
import { Document, IDocumentOptions } from "./document";
|
||||
import { Footer } from "./footer/footer";
|
||||
import { FootNotes } from "./footnotes";
|
||||
import { Header } from "./header/header";
|
||||
import { Relationships } from "./relationships";
|
||||
import { XmlComponent } from "./xml-components";
|
||||
|
||||
export interface IViewWrapper {
|
||||
export type IViewWrapper = {
|
||||
readonly View: Document | Footer | Header | FootNotes | XmlComponent;
|
||||
readonly Relationships: Relationships;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocumentWrapper implements IViewWrapper {
|
||||
private readonly document: Document;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
|
||||
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
||||
|
||||
import { Column } from "./column";
|
||||
|
||||
|
@ -17,7 +17,6 @@ import { decimalNumber } from "@util/values";
|
||||
// <xsd:attribute name="charSpace" type="ST_DecimalNumber"/>
|
||||
// </xsd:complexType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const DocumentGridType = {
|
||||
DEFAULT: "default",
|
||||
LINES: "lines",
|
||||
@ -25,12 +24,11 @@ export const DocumentGridType = {
|
||||
SNAP_TO_CHARS: "snapToChars",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
export interface IDocGridAttributesProperties {
|
||||
export type IDocGridAttributesProperties = {
|
||||
readonly type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];
|
||||
readonly linePitch?: number;
|
||||
readonly charSpace?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesProperties> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./header-footer-reference";
|
||||
|
||||
describe("HeaderFooterReference", () => {
|
||||
|
@ -32,10 +32,10 @@ export const HeaderFooterReferenceType = {
|
||||
// <xsd:attribute ref="r:id" use="required"/>
|
||||
// </xsd:complexType>
|
||||
|
||||
export interface IHeaderFooterOptions {
|
||||
export type IHeaderFooterOptions = {
|
||||
readonly type?: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
readonly id?: number;
|
||||
}
|
||||
};
|
||||
|
||||
class FooterReferenceAttributes extends XmlAttributeComponent<{
|
||||
readonly type: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
|
@ -1,6 +1,6 @@
|
||||
// http://officeopenxml.com/WPsectionLineNumbering.php
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
|
||||
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
||||
|
||||
// <xsd:simpleType name="ST_LineNumberRestart">
|
||||
// <xsd:restriction base="xsd:string">
|
||||
@ -10,13 +10,11 @@ import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@uti
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const LineNumberRestartFormat = {
|
||||
NEW_PAGE: "newPage",
|
||||
NEW_SECTION: "newSection",
|
||||
CONTINUOUS: "continuous",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:complexType name="CT_LineNumber">
|
||||
// <xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
|
||||
|
@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { BorderStyle } from "@file/border";
|
||||
|
||||
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
|
||||
import { PageBorderDisplay, PageBorderZOrder, PageBorders } from "./page-borders";
|
||||
|
||||
describe("PageBorders", () => {
|
||||
describe("#constructor()", () => {
|
||||
|
@ -10,13 +10,11 @@ import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent } from "@file/xml-comp
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageBorderDisplay = {
|
||||
ALL_PAGES: "allPages",
|
||||
FIRST_PAGE: "firstPage",
|
||||
NOT_FIRST_PAGE: "notFirstPage",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:simpleType name="ST_PageBorderOffset">
|
||||
// <xsd:restriction base="xsd:string">
|
||||
@ -40,19 +38,19 @@ export const PageBorderZOrder = {
|
||||
FRONT: "front",
|
||||
} as const;
|
||||
|
||||
export interface IPageBorderAttributes {
|
||||
export type IPageBorderAttributes = {
|
||||
readonly display?: (typeof PageBorderDisplay)[keyof typeof PageBorderDisplay];
|
||||
readonly offsetFrom?: (typeof PageBorderOffsetFrom)[keyof typeof PageBorderOffsetFrom];
|
||||
readonly zOrder?: (typeof PageBorderZOrder)[keyof typeof PageBorderZOrder];
|
||||
}
|
||||
};
|
||||
|
||||
export interface IPageBordersOptions {
|
||||
export type IPageBordersOptions = {
|
||||
readonly pageBorders?: IPageBorderAttributes;
|
||||
readonly pageBorderTop?: IBorderOptions;
|
||||
readonly pageBorderRight?: IBorderOptions;
|
||||
readonly pageBorderBottom?: IBorderOptions;
|
||||
readonly pageBorderLeft?: IBorderOptions;
|
||||
}
|
||||
};
|
||||
|
||||
class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { PositiveUniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue, UniversalMeasure } from "@util/values";
|
||||
import { PositiveUniversalMeasure, UniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
|
||||
|
||||
// <xsd:complexType name="CT_PageMar">
|
||||
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>
|
||||
|
@ -13,7 +13,6 @@ import { decimalNumber } from "@util/values";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageNumberSeparator = {
|
||||
HYPHEN: "hyphen",
|
||||
PERIOD: "period",
|
||||
@ -22,13 +21,11 @@ export const PageNumberSeparator = {
|
||||
EN_DASH: "endash",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
export interface IPageNumberTypeAttributes {
|
||||
export type IPageNumberTypeAttributes = {
|
||||
readonly start?: number;
|
||||
readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat];
|
||||
readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_PageNumber">
|
||||
// <xsd:attribute name="fmt" type="ST_NumberFormat" use="optional" default="decimal"/>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { PageTextDirection, PageTextDirectionType } from "./page-text-direction";
|
||||
|
||||
describe("PageTextDirection", () => {
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageTextDirectionType = {
|
||||
LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
|
||||
TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
class PageTextDirectionAttributes extends XmlAttributeComponent<{
|
||||
readonly val: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType];
|
||||
}> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { SectionType, Type } from "./section-type";
|
||||
|
||||
describe("Type", () => {
|
||||
|
@ -11,7 +11,6 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const SectionType = {
|
||||
NEXT_PAGE: "nextPage",
|
||||
NEXT_COLUMN: "nextColumn",
|
||||
@ -19,7 +18,6 @@ export const SectionType = {
|
||||
EVEN_PAGE: "evenPage",
|
||||
ODD_PAGE: "oddPage",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:complexType name="CT_SectType">
|
||||
// <xsd:attribute name="val" type="ST_SectionMark"/>
|
||||
|
@ -15,7 +15,7 @@ import { LineNumberRestartFormat } from "./properties/line-number";
|
||||
import { PageBorderOffsetFrom } from "./properties/page-borders";
|
||||
import { PageTextDirectionType } from "./properties/page-text-direction";
|
||||
import { SectionType } from "./properties/section-type";
|
||||
import { sectionMarginDefaults, sectionPageSizeDefaults, SectionProperties } from "./section-properties";
|
||||
import { SectionProperties, sectionMarginDefaults, sectionPageSizeDefaults } from "./section-properties";
|
||||
|
||||
const DEFAULT_MARGINS = {
|
||||
"w:bottom": sectionMarginDefaults.BOTTOM,
|
||||
|
@ -1,14 +1,13 @@
|
||||
// http://officeopenxml.com/WPsection.php
|
||||
// tslint:disable: no-unnecessary-initializer
|
||||
|
||||
import { FooterWrapper } from "@file/footer-wrapper";
|
||||
import { HeaderWrapper } from "@file/header-wrapper";
|
||||
import { VerticalAlign, VerticalAlignElement } from "@file/vertical-align";
|
||||
import { OnOffElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
||||
import { Columns, IColumnsAttributes } from "./properties/columns";
|
||||
import { DocumentGrid, IDocGridAttributesProperties } from "./properties/doc-grid";
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
||||
import { ILineNumberAttributes, createLineNumberType } from "./properties/line-number";
|
||||
import { IPageBordersOptions, PageBorders } from "./properties/page-borders";
|
||||
import { IPageMarginAttributes, PageMargin } from "./properties/page-margin";
|
||||
@ -17,13 +16,13 @@ import { IPageSizeAttributes, PageOrientation, PageSize } from "./properties/pag
|
||||
import { PageTextDirection, PageTextDirectionType } from "./properties/page-text-direction";
|
||||
import { SectionType, Type } from "./properties/section-type";
|
||||
|
||||
export interface IHeaderFooterGroup<T> {
|
||||
export type IHeaderFooterGroup<T> = {
|
||||
readonly default?: T;
|
||||
readonly first?: T;
|
||||
readonly even?: T;
|
||||
}
|
||||
};
|
||||
|
||||
export interface ISectionPropertiesOptions {
|
||||
export type ISectionPropertiesOptions = {
|
||||
readonly page?: {
|
||||
readonly size?: IPageSizeAttributes;
|
||||
readonly margin?: IPageMarginAttributes;
|
||||
@ -39,7 +38,7 @@ export interface ISectionPropertiesOptions {
|
||||
readonly verticalAlign?: (typeof VerticalAlign)[keyof typeof VerticalAlign];
|
||||
readonly column?: IColumnsAttributes;
|
||||
readonly type?: (typeof SectionType)[keyof typeof SectionType];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_SectPr">
|
||||
// <xsd:sequence>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlAttributeComponent } from "@file/xml-components";
|
||||
|
||||
/* cSpell:disable */
|
||||
export interface IDocumentAttributesProperties {
|
||||
export type IDocumentAttributesProperties = {
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -41,7 +41,7 @@ export interface IDocumentAttributesProperties {
|
||||
readonly w16?: string;
|
||||
readonly w16sdtdh?: string;
|
||||
readonly w16se?: string;
|
||||
}
|
||||
};
|
||||
/* cSpell:enable */
|
||||
|
||||
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
||||
|
@ -39,12 +39,12 @@ export class DocumentBackgroundAttributes extends XmlAttributeComponent<{
|
||||
};
|
||||
}
|
||||
|
||||
export interface IDocumentBackgroundOptions {
|
||||
export type IDocumentBackgroundOptions = {
|
||||
readonly color?: string;
|
||||
readonly themeColor?: string;
|
||||
readonly themeShade?: string;
|
||||
readonly themeTint?: string;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_Background">
|
||||
// <xsd:sequence>
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/WPdocument.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ConcreteHyperlink, Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { TableOfContents } from "../table-of-contents";
|
||||
@ -7,9 +8,9 @@ import { Body } from "./body";
|
||||
import { DocumentAttributes } from "./document-attributes";
|
||||
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
|
||||
|
||||
export interface IDocumentOptions {
|
||||
export type IDocumentOptions = {
|
||||
readonly background?: IDocumentBackgroundOptions;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:element name="document" type="CT_Document"/>
|
||||
//
|
||||
@ -80,7 +81,6 @@ export class Document extends XmlComponent {
|
||||
}
|
||||
|
||||
public add(item: Paragraph | Table | TableOfContents | ConcreteHyperlink): Document {
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
this.body.push(item);
|
||||
return this;
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { XmlAttributeComponent } from "@file/xml-components";
|
||||
|
||||
import { IDistance } from "../drawing";
|
||||
|
||||
export interface IAnchorAttributes extends IDistance {
|
||||
export type IAnchorAttributes = {
|
||||
readonly allowOverlap?: "0" | "1";
|
||||
readonly behindDoc?: "0" | "1";
|
||||
readonly layoutInCell?: "0" | "1";
|
||||
readonly locked?: "0" | "1";
|
||||
readonly relativeHeight?: number;
|
||||
readonly simplePos?: "0" | "1";
|
||||
}
|
||||
} & IDistance;
|
||||
|
||||
export class AnchorAttributes extends XmlAttributeComponent<IAnchorAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { assert, describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { Utility } from "tests/utility";
|
||||
|
||||
import { IDrawingOptions } from "../drawing";
|
||||
@ -11,8 +10,9 @@ import { Anchor } from "./anchor";
|
||||
const createAnchor = (drawingOptions: IDrawingOptions): Anchor =>
|
||||
new Anchor({
|
||||
mediaData: {
|
||||
type: "png",
|
||||
fileName: "test.png",
|
||||
stream: Buffer.from(""),
|
||||
data: Buffer.from(""),
|
||||
transformation: {
|
||||
pixels: {
|
||||
x: 0,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// http://officeopenxml.com/drwPicFloating.php
|
||||
import { IMediaData, IMediaDataTransformation } from "@file/media";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { IDrawingOptions } from "../drawing";
|
||||
import { HorizontalPosition, IFloating, SimplePos, VerticalPosition } from "../floating";
|
||||
import { Graphic } from "../inline/graphic";
|
||||
|
@ -1,7 +1,6 @@
|
||||
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docPr_topic_ID0ES32OB.html
|
||||
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { ConcreteHyperlink } from "@file/paragraph";
|
||||
|
||||
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { docPropertiesUniqueNumericIdGen } from "@util/convenience-functions";
|
||||
|
||||
import { createHyperlinkClick } from "./doc-properties-children";
|
||||
@ -18,11 +17,11 @@ import { createHyperlinkClick } from "./doc-properties-children";
|
||||
// <attribute name="hidden" type="xsd:boolean" use="optional" default="false" />
|
||||
// </complexType>
|
||||
|
||||
export interface DocPropertiesOptions {
|
||||
export type DocPropertiesOptions = {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly title: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
private readonly docPropertiesUniqueNumericId = docPropertiesUniqueNumericIdGen();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { IContext } from "@file/xml-components";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { IContext } from "@file/xml-components";
|
||||
|
||||
import { ConcreteHyperlink, TextRun } from "../";
|
||||
import { Drawing, IDrawingOptions } from "./drawing";
|
||||
@ -11,8 +11,9 @@ const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEU
|
||||
const createDrawing = (drawingOptions?: IDrawingOptions): Drawing =>
|
||||
new Drawing(
|
||||
{
|
||||
type: "jpg",
|
||||
fileName: "test.jpg",
|
||||
stream: Buffer.from(imageBase64Data, "base64"),
|
||||
data: Buffer.from(imageBase64Data, "base64"),
|
||||
transformation: {
|
||||
pixels: {
|
||||
x: 100,
|
||||
@ -79,7 +80,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -138,7 +138,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
@ -310,7 +309,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -369,7 +367,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
@ -553,7 +550,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -621,7 +617,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
|
@ -14,11 +14,11 @@ export type IDistance = {
|
||||
readonly distR?: number;
|
||||
};
|
||||
|
||||
export interface IDrawingOptions {
|
||||
export type IDrawingOptions = {
|
||||
readonly floating?: IFloating;
|
||||
readonly docProperties?: DocPropertiesOptions;
|
||||
readonly outline?: OutlineOptions;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_Drawing">
|
||||
// <xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
|
@ -7,6 +7,12 @@ export type EffectExtentAttributes = {
|
||||
readonly left: number;
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_EffectExtent">
|
||||
// <xsd:attribute name="l" type="a:ST_Coordinate" use="required"/>
|
||||
// <xsd:attribute name="t" type="a:ST_Coordinate" use="required"/>
|
||||
// <xsd:attribute name="r" type="a:ST_Coordinate" use="required"/>
|
||||
// <xsd:attribute name="b" type="a:ST_Coordinate" use="required"/>
|
||||
// </xsd:complexType>
|
||||
export const createEffectExtent = ({ top, right, bottom, left }: EffectExtentAttributes): XmlComponent =>
|
||||
new BuilderElement<EffectExtentAttributes>({
|
||||
name: "wp:effectExtent",
|
||||
|
@ -4,7 +4,6 @@ import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/ali
|
||||
|
||||
import { ITextWrapping } from "../text-wrap";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const HorizontalPositionRelativeFrom = {
|
||||
CHARACTER: "character",
|
||||
COLUMN: "column",
|
||||
@ -27,27 +26,26 @@ export const VerticalPositionRelativeFrom = {
|
||||
TOP_MARGIN: "topMargin",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
export interface IHorizontalPositionOptions {
|
||||
export type IHorizontalPositionOptions = {
|
||||
readonly relative?: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
|
||||
readonly align?: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];
|
||||
readonly offset?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IVerticalPositionOptions {
|
||||
export type IVerticalPositionOptions = {
|
||||
readonly relative?: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
|
||||
readonly align?: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];
|
||||
readonly offset?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IMargins {
|
||||
export type IMargins = {
|
||||
readonly left?: number;
|
||||
readonly bottom?: number;
|
||||
readonly top?: number;
|
||||
readonly right?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IFloating {
|
||||
export type IFloating = {
|
||||
readonly horizontalPosition: IHorizontalPositionOptions;
|
||||
readonly verticalPosition: IVerticalPositionOptions;
|
||||
readonly allowOverlap?: boolean;
|
||||
@ -57,4 +55,4 @@ export interface IFloating {
|
||||
readonly margins?: IMargins;
|
||||
readonly wrap?: ITextWrapping;
|
||||
readonly zIndex?: number;
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-position.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Align } from "./align";
|
||||
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-position.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Align } from "./align";
|
||||
import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes";
|
||||
|
||||
export class GraphicFrameLocks extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks";
|
||||
|
||||
export class GraphicFrameProperties extends XmlComponent {
|
||||
|
@ -0,0 +1,35 @@
|
||||
import { IMediaData } from "@file/media";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
const createSvgBlip = (mediaData: IMediaData): XmlComponent =>
|
||||
new BuilderElement({
|
||||
name: "asvg:svgBlip",
|
||||
attributes: {
|
||||
asvg: {
|
||||
key: "xmlns:asvg",
|
||||
value: "http://schemas.microsoft.com/office/drawing/2016/SVG/main",
|
||||
},
|
||||
embed: {
|
||||
key: "r:embed",
|
||||
value: `rId{${mediaData.fileName}}`,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const createExtention = (mediaData: IMediaData): XmlComponent =>
|
||||
new BuilderElement({
|
||||
name: "a:ext",
|
||||
attributes: {
|
||||
uri: {
|
||||
key: "uri",
|
||||
value: "{96DAC541-7B7A-43D3-8B79-37D633B846F1}",
|
||||
},
|
||||
},
|
||||
children: [createSvgBlip(mediaData)],
|
||||
});
|
||||
|
||||
export const createExtentionList = (mediaData: IMediaData): XmlComponent =>
|
||||
new BuilderElement({
|
||||
name: "a:extLst",
|
||||
children: [createExtention(mediaData)],
|
||||
});
|
@ -1,7 +1,7 @@
|
||||
import { IMediaData } from "@file/media";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Blip } from "./blip";
|
||||
import { createBlip } from "./blip";
|
||||
import { SourceRectangle } from "./source-rectangle";
|
||||
import { Stretch } from "./stretch";
|
||||
|
||||
@ -9,7 +9,7 @@ export class BlipFill extends XmlComponent {
|
||||
public constructor(mediaData: IMediaData) {
|
||||
super("pic:blipFill");
|
||||
|
||||
this.root.push(new Blip(mediaData));
|
||||
this.root.push(createBlip(mediaData));
|
||||
this.root.push(new SourceRectangle());
|
||||
this.root.push(new Stretch());
|
||||
}
|
||||
|
@ -1,24 +1,25 @@
|
||||
import { IMediaData } from "@file/media";
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
class BlipAttributes extends XmlAttributeComponent<{
|
||||
import { createExtentionList } from "./blip-extentions";
|
||||
|
||||
type BlipAttributes = {
|
||||
readonly embed: string;
|
||||
readonly cstate: string;
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
embed: "r:embed",
|
||||
cstate: "cstate",
|
||||
};
|
||||
}
|
||||
|
||||
export class Blip extends XmlComponent {
|
||||
public constructor(mediaData: IMediaData) {
|
||||
super("a:blip");
|
||||
this.root.push(
|
||||
new BlipAttributes({
|
||||
embed: `rId{${mediaData.fileName}}`,
|
||||
cstate: "none",
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
export const createBlip = (mediaData: IMediaData): XmlComponent =>
|
||||
new BuilderElement<BlipAttributes>({
|
||||
name: "a:blip",
|
||||
attributes: {
|
||||
embed: {
|
||||
key: "r:embed",
|
||||
value: `rId{${mediaData.type === "svg" ? mediaData.fallback.fileName : mediaData.fileName}}`,
|
||||
},
|
||||
cstate: {
|
||||
key: "cstate",
|
||||
value: "none",
|
||||
},
|
||||
},
|
||||
children: mediaData.type === "svg" ? [createExtentionList(mediaData)] : [],
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { PicLocks } from "./pic-locks/pic-locks";
|
||||
|
||||
export class ChildNonVisualProperties extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { PicLocksAttributes } from "./pic-locks-attributes";
|
||||
|
||||
export class PicLocks extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ChildNonVisualProperties } from "./child-non-visual-pic-properties/child-non-visual-pic-properties";
|
||||
import { NonVisualProperties } from "./non-visual-properties/non-visual-properties";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
import { createHyperlinkClick } from "@file/drawing/doc-properties/doc-properties-children";
|
||||
import { ConcreteHyperlink } from "@file/paragraph";
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes";
|
||||
|
||||
|
@ -5,8 +5,8 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { BlipFill } from "./blip/blip-fill";
|
||||
import { NonVisualPicProperties } from "./non-visual-pic-properties/non-visual-pic-properties";
|
||||
import { PicAttributes } from "./pic-attributes";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
import { OutlineOptions } from "./shape-properties/outline/outline";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
public constructor({
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { Form } from "./form/form";
|
||||
|
||||
describe("Form", () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ExtentsAttributes } from "./extents-attributes";
|
||||
|
||||
export class Extents extends XmlComponent {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { OffsetAttributes } from "./off-attributes";
|
||||
|
||||
export class Offset extends XmlComponent {
|
||||
|
@ -1,8 +1,9 @@
|
||||
// http://officeopenxml.com/drwSp-outline.php
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createNoFill } from "./no-fill";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
import { SchemeColor } from "./scheme-color";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
|
||||
// <xsd:complexType name="CT_TextOutlineEffect">
|
||||
// <xsd:sequence>
|
||||
|
@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
import { SchemeColor } from "./scheme-color";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
|
||||
describe("createSolidFill", () => {
|
||||
it("should create of rgb", () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createSchemeColor, SchemeColor } from "./scheme-color";
|
||||
import { createSolidRgbColor } from "./rgb-color";
|
||||
import { SchemeColor, createSchemeColor } from "./scheme-color";
|
||||
|
||||
export type RgbColorOptions = {
|
||||
readonly type: "rgb";
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-prstGeom.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { AdjustmentValues } from "./adjustment-values/adjustment-values";
|
||||
import { PresetGeometryAttributes } from "./preset-geometry-attributes";
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
// http://officeopenxml.com/drwSp-SpPr.php
|
||||
import { IMediaDataTransformation } from "@file/media";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Form } from "./form";
|
||||
import { createNoFill } from "./outline/no-fill";
|
||||
import { OutlineOptions, createOutline } from "./outline/outline";
|
||||
import { PresetGeometry } from "./preset-geometry/preset-geometry";
|
||||
import { ShapePropertiesAttributes } from "./shape-properties-attributes";
|
||||
import { createNoFill } from "./outline/no-fill";
|
||||
|
||||
export class ShapeProperties extends XmlComponent {
|
||||
private readonly form: Form;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { createInline } from "./inline";
|
||||
|
||||
describe("Inline", () => {
|
||||
@ -8,8 +9,9 @@ describe("Inline", () => {
|
||||
const tree = new Formatter().format(
|
||||
createInline({
|
||||
mediaData: {
|
||||
type: "png",
|
||||
fileName: "test.png",
|
||||
stream: Buffer.from(""),
|
||||
data: Buffer.from(""),
|
||||
transformation: {
|
||||
pixels: {
|
||||
x: 0,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// http://officeopenxml.com/drwPicInline.php
|
||||
import { IMediaData, IMediaDataTransformation } from "@file/media";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { DocProperties, DocPropertiesOptions } from "./../doc-properties/doc-properties";
|
||||
import { createEffectExtent } from "./../effect-extent/effect-extent";
|
||||
import { Extent } from "./../extent/extent";
|
||||
|
@ -1,7 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-textWrap.php
|
||||
import { IDistance } from "../drawing";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const TextWrappingType = {
|
||||
NONE: 0,
|
||||
SQUARE: 1,
|
||||
@ -16,10 +15,8 @@ export const TextWrappingSide = {
|
||||
LARGEST: "largest",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
export interface ITextWrapping {
|
||||
export type ITextWrapping = {
|
||||
readonly type: (typeof TextWrappingType)[keyof typeof TextWrappingType];
|
||||
readonly side?: (typeof TextWrappingSide)[keyof typeof TextWrappingSide];
|
||||
readonly margins?: IDistance;
|
||||
}
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user