58
.cspell.json
Normal file
58
.cspell.json
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// cSpell Settings
|
||||||
|
{
|
||||||
|
// Version of the setting file. Always 0.2
|
||||||
|
"version": "0.2",
|
||||||
|
// language - current active spelling language
|
||||||
|
"language": "en_US",
|
||||||
|
"dictionaries": ["en_US", "typescript", "softwareTerms", "fonts", "npm"],
|
||||||
|
// words - list of words to be always considered correct
|
||||||
|
"words": [
|
||||||
|
"Xmlable",
|
||||||
|
"twip",
|
||||||
|
"twips",
|
||||||
|
"jsonify",
|
||||||
|
"falsey",
|
||||||
|
"aiueo",
|
||||||
|
"iroha",
|
||||||
|
"aiueo",
|
||||||
|
"iroha",
|
||||||
|
"chosung",
|
||||||
|
"Abjad",
|
||||||
|
"Initializable",
|
||||||
|
"rels",
|
||||||
|
"dolan",
|
||||||
|
"xmlify",
|
||||||
|
"Xmlifyed",
|
||||||
|
"xmlified",
|
||||||
|
"datas",
|
||||||
|
"jszip",
|
||||||
|
"rsid",
|
||||||
|
"NUMPAGES",
|
||||||
|
"ATLEAST",
|
||||||
|
"ooxml",
|
||||||
|
"clippy",
|
||||||
|
"docsify"
|
||||||
|
],
|
||||||
|
"ignoreRegExpList": [
|
||||||
|
"/\"w:.+\"/",
|
||||||
|
"/\"s:.+\"/",
|
||||||
|
"/\"a:.+\"/",
|
||||||
|
"/\"pic:.+\"/",
|
||||||
|
"/\"xmlns:.+\"/",
|
||||||
|
"/\"vt:.+\"/",
|
||||||
|
"/[^\\s]{40,}/",
|
||||||
|
"/<xsd:.+/>/",
|
||||||
|
"/[A-Z_]+ = \".+\"/",
|
||||||
|
"/XmlAttributeComponent<{[^}]+}>/g",
|
||||||
|
"/xmlKeys = {[^}]+}/g",
|
||||||
|
"/\\.to\\.deep\\.equal\\({[^)]+}\\)/g",
|
||||||
|
"\\.to\\.include\\.members\\(\\[[^\\]]+]\\)",
|
||||||
|
"/new [a-zA-Z]+\\({[^£]+}\\)/g"
|
||||||
|
],
|
||||||
|
"ignorePaths": ["package.json", "docs/api"],
|
||||||
|
"allowCompoundWords": true,
|
||||||
|
// flagWords - list of words to be always considered incorrect
|
||||||
|
// This is useful for offensive words and common spelling errors.
|
||||||
|
// For example "hte" should be "the"
|
||||||
|
"flagWords": ["hte"]
|
||||||
|
}
|
10
.github/workflows/default.yml
vendored
10
.github/workflows/default.yml
vendored
@ -58,3 +58,13 @@ jobs:
|
|||||||
run: npm ci --force
|
run: npm ci --force
|
||||||
- name: Prettier
|
- name: Prettier
|
||||||
run: npm run style
|
run: npm run style
|
||||||
|
cspell:
|
||||||
|
name: CSpell
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci --force
|
||||||
|
- name: Prettier
|
||||||
|
run: npm run cspell
|
||||||
|
8
.nycrc
8
.nycrc
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"check-coverage": true,
|
"check-coverage": true,
|
||||||
"statements": 99.43,
|
"statements": 99.62,
|
||||||
"branches": 96.6,
|
"branches": 96.81,
|
||||||
"functions": 99.47,
|
"functions": 99.82,
|
||||||
"lines": 99.43,
|
"lines": 99.62,
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.ts"
|
||||||
],
|
],
|
||||||
|
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"streetsidesoftware.code-spell-checker"
|
||||||
|
]
|
||||||
|
}
|
31
README.md
31
README.md
@ -26,21 +26,21 @@
|
|||||||
|
|
||||||
Here are examples of `docx` being used with basic `HTML/JS` in a browser environment:
|
Here are examples of `docx` being used with basic `HTML/JS` in a browser environment:
|
||||||
|
|
||||||
* https://codepen.io/dolanmiu/pen/RwNeObg
|
- https://codepen.io/dolanmiu/pen/RwNeObg
|
||||||
* https://jsfiddle.net/dolanmiu/onadx1gu/
|
- https://jsfiddle.net/dolanmiu/onadx1gu/
|
||||||
|
|
||||||
Here is an example of `docx` working in `Angular`:
|
Here is an example of `docx` working in `Angular`:
|
||||||
|
|
||||||
* https://stackblitz.com/edit/angular-docx
|
- https://stackblitz.com/edit/angular-docx
|
||||||
|
|
||||||
Here is an example of `docx` working in `React`:
|
Here is an example of `docx` working in `React`:
|
||||||
|
|
||||||
* https://stackblitz.com/edit/react-docx
|
- https://stackblitz.com/edit/react-docx
|
||||||
* https://stackblitz.com/edit/react-docx-images (adding images to Word Document)
|
- https://stackblitz.com/edit/react-docx-images (adding images to Word Document)
|
||||||
|
|
||||||
Here is an example of `docx` working in `Vue.js`:
|
Here is an example of `docx` working in `Vue.js`:
|
||||||
|
|
||||||
* https://stackblitz.com/edit/vuejs-docx
|
- https://stackblitz.com/edit/vuejs-docx
|
||||||
|
|
||||||
## Node
|
## Node
|
||||||
|
|
||||||
@ -48,15 +48,15 @@ Press `endpoint` on the `RunKit` website:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
* https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text
|
- https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text
|
||||||
* https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text
|
- https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text
|
||||||
* https://runkit.com/dolanmiu/docx-demo3 - Bullet points
|
- https://runkit.com/dolanmiu/docx-demo3 - Bullet points
|
||||||
* https://runkit.com/dolanmiu/docx-demo4 - Simple table
|
- https://runkit.com/dolanmiu/docx-demo4 - Simple table
|
||||||
* https://runkit.com/dolanmiu/docx-demo5 - Images
|
- https://runkit.com/dolanmiu/docx-demo5 - Images
|
||||||
* https://runkit.com/dolanmiu/docx-demo6 - Margins
|
- https://runkit.com/dolanmiu/docx-demo6 - Margins
|
||||||
* https://runkit.com/dolanmiu/docx-demo7 - Landscape
|
- https://runkit.com/dolanmiu/docx-demo7 - Landscape
|
||||||
* https://runkit.com/dolanmiu/docx-demo8 - Header and Footer
|
- https://runkit.com/dolanmiu/docx-demo8 - Header and Footer
|
||||||
* https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx**
|
- https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx**
|
||||||
|
|
||||||
More [here](https://github.com/dolanmiu/docx/tree/master/demo)
|
More [here](https://github.com/dolanmiu/docx/tree/master/demo)
|
||||||
|
|
||||||
@ -88,7 +88,6 @@ 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/PXo25um.png" alt="drawing" height="50"/>](https://www.circadianrisk.com/)
|
||||||
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
[<img src="https://i.imgur.com/AKGhtlh.png" alt="drawing"/>](https://lexense.com/)
|
||||||
|
|
||||||
|
|
||||||
...and many more!
|
...and many more!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -43,7 +43,7 @@ interface Skill {
|
|||||||
readonly name: string;
|
readonly name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Achivement {
|
interface Achievement {
|
||||||
readonly issuer: string;
|
readonly issuer: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ const experiences: Experience[] = [
|
|||||||
{
|
{
|
||||||
isCurrent: false,
|
isCurrent: false,
|
||||||
summary:
|
summary:
|
||||||
"Full-stack developer working with Angular, Node and TypeScript. Working for the iShares platform. Emphasis on Dev-ops and developing the continous integration pipeline.",
|
"Full-stack developer working with Angular, Node and TypeScript. Working for the iShares platform. Emphasis on Dev-ops and developing the continuous integration pipeline.",
|
||||||
title: "Software Developer",
|
title: "Software Developer",
|
||||||
endDate: {
|
endDate: {
|
||||||
month: 11,
|
month: 11,
|
||||||
@ -98,6 +98,7 @@ const experiences: Experience[] = [
|
|||||||
{
|
{
|
||||||
isCurrent: false,
|
isCurrent: false,
|
||||||
summary:
|
summary:
|
||||||
|
// cspell:disable-next-line
|
||||||
"Develop web commerce platforms for various high profile clients.\n\nCreated a log analysis web application with the Play Framework in Java, incorporating Test Driven Development. It asynchronously uploads and processes large (2 GB) log files, and outputs meaningful results in context with the problem. \n\nAnalysis and development of the payment system infrastructure and user accounts section to be used by several clients of the company such as Waitrose, Tally Weijl, DJ Sports, Debenhams, Ann Summers, John Lewis and others.\n\nTechnologies used include WebSphere Commerce, Java, JavaScript and JSP.",
|
"Develop web commerce platforms for various high profile clients.\n\nCreated a log analysis web application with the Play Framework in Java, incorporating Test Driven Development. It asynchronously uploads and processes large (2 GB) log files, and outputs meaningful results in context with the problem. \n\nAnalysis and development of the payment system infrastructure and user accounts section to be used by several clients of the company such as Waitrose, Tally Weijl, DJ Sports, Debenhams, Ann Summers, John Lewis and others.\n\nTechnologies used include WebSphere Commerce, Java, JavaScript and JSP.",
|
||||||
title: "Java Developer",
|
title: "Java Developer",
|
||||||
endDate: {
|
endDate: {
|
||||||
@ -118,7 +119,7 @@ const education: Education[] = [
|
|||||||
{
|
{
|
||||||
degree: "Master of Science (MSc)",
|
degree: "Master of Science (MSc)",
|
||||||
fieldOfStudy: "Computer Science",
|
fieldOfStudy: "Computer Science",
|
||||||
notes: "Exam Results: 1st Class with Distinction, Dissertation: 1st Class with Distinction\n\nRelevant Courses: Java and C# Programming, Software Engineering, Artificial Intelligence, \nComputational Photography, Algorithmics, Architecture and Hardware.\n\nCreated a Windows 8 game in JavaScript for the dissertation. \n\nCreated an award-winning 3D stereoscopic game in C# using XNA.",
|
notes: "Exam Results: 1st Class with Distinction, Dissertation: 1st Class with Distinction\n\nRelevant Courses: Java and C# Programming, Software Engineering, Artificial Intelligence, \nComputational Photography, Algorithms, Architecture and Hardware.\n\nCreated a Windows 8 game in JavaScript for the dissertation. \n\nCreated an award-winning 3D stereoscopic game in C# using XNA.",
|
||||||
schoolName: "University College London",
|
schoolName: "University College London",
|
||||||
startDate: {
|
startDate: {
|
||||||
year: 2012,
|
year: 2012,
|
||||||
@ -156,7 +157,7 @@ const skills: Skill[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const achievements: Achivement[] = [
|
const achievements: Achievement[] = [
|
||||||
{
|
{
|
||||||
issuer: "Oracle",
|
issuer: "Oracle",
|
||||||
name: "Oracle Certified Expert",
|
name: "Oracle Certified Expert",
|
||||||
@ -165,7 +166,7 @@ const achievements: Achivement[] = [
|
|||||||
|
|
||||||
class DocumentCreator {
|
class DocumentCreator {
|
||||||
// tslint:disable-next-line: typedef
|
// tslint:disable-next-line: typedef
|
||||||
public create([experiences, educations, skills, achivements]: [Experience[], Education[], Skill[], Achivement[]]): Document {
|
public create([experiences, educations, skills, achievements]: [Experience[], Education[], Skill[], Achievement[]]): Document {
|
||||||
const document = new Document({
|
const document = new Document({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
@ -221,7 +222,7 @@ class DocumentCreator {
|
|||||||
this.createSubHeading("Skills"),
|
this.createSubHeading("Skills"),
|
||||||
this.createSkillList(skills),
|
this.createSkillList(skills),
|
||||||
this.createSubHeading("Achievements"),
|
this.createSubHeading("Achievements"),
|
||||||
...this.createAchivementsList(achivements),
|
...this.createAchievementsList(achievements),
|
||||||
this.createSubHeading("Interests"),
|
this.createSubHeading("Interests"),
|
||||||
this.createInterests("Programming, Technology, Music Production, Web Design, 3D Modelling, Dancing."),
|
this.createInterests("Programming, Technology, Music Production, Web Design, 3D Modelling, Dancing."),
|
||||||
this.createHeading("References"),
|
this.createHeading("References"),
|
||||||
@ -318,8 +319,8 @@ class DocumentCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line:no-any
|
// tslint:disable-next-line:no-any
|
||||||
public createAchivementsList(achivements: any[]): Paragraph[] {
|
public createAchievementsList(achievements: any[]): Paragraph[] {
|
||||||
return achivements.map(
|
return achievements.map(
|
||||||
(achievement) =>
|
(achievement) =>
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
text: achievement.name,
|
text: achievement.name,
|
||||||
|
@ -52,18 +52,20 @@ const table = new Table({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
numbering:{
|
numbering: {
|
||||||
config:[{
|
config: [
|
||||||
reference: 'ref1',
|
{
|
||||||
|
reference: "ref1",
|
||||||
levels: [
|
levels: [
|
||||||
{
|
{
|
||||||
level: 0,
|
level: 0,
|
||||||
format: LevelFormat.DECIMAL,
|
format: LevelFormat.DECIMAL,
|
||||||
text: '%1)',
|
text: "%1)",
|
||||||
start: 50,
|
start: 50,
|
||||||
}
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
default: {
|
default: {
|
||||||
@ -184,11 +186,11 @@ const doc = new Document({
|
|||||||
spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 },
|
spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 },
|
||||||
rightTabStop: TabStopPosition.MAX,
|
rightTabStop: TabStopPosition.MAX,
|
||||||
leftTabStop: 453.543307087,
|
leftTabStop: 453.543307087,
|
||||||
numbering : {
|
numbering: {
|
||||||
reference: 'ref1',
|
reference: "ref1",
|
||||||
instance: 0,
|
instance: 0,
|
||||||
level: 0,
|
level: 0,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -18,10 +18,15 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: ["Hello", new FootnoteReferenceRun(1)],
|
children: ["Hello"],
|
||||||
}),
|
}),
|
||||||
|
new FootnoteReferenceRun(1),
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: [" World!", new FootnoteReferenceRun(2)],
|
children: [" World!"],
|
||||||
|
}),
|
||||||
|
new FootnoteReferenceRun(2),
|
||||||
|
new TextRun({
|
||||||
|
children: [" GitHub!"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@ -35,15 +40,17 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: ["Hello", new FootnoteReferenceRun(4)],
|
children: ["Hello"],
|
||||||
}),
|
}),
|
||||||
|
new FootnoteReferenceRun(4),
|
||||||
new TextRun({
|
new TextRun({
|
||||||
children: [" World!", new FootnoteReferenceRun(5)],
|
children: [" World!"],
|
||||||
}),
|
}),
|
||||||
|
new FootnoteReferenceRun(5),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [new TextRun("Hello World"), new FootnoteReferenceRun(6)],
|
children: [new TextRun("Hello World Again"), new FootnoteReferenceRun(6)],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Example on how to customise the look at feel using Styles
|
// Example on how to customize the look at feel using Styles
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
// This demo shows how to create bookmarks then link to them with internal hyperlinks
|
// This demo shows how to create bookmarks then link to them with internal hyperlinks
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Bookmark, Document, Footer, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun, PageReference } from "../build";
|
import {
|
||||||
|
Bookmark,
|
||||||
|
Document,
|
||||||
|
Footer,
|
||||||
|
HeadingLevel,
|
||||||
|
InternalHyperlink,
|
||||||
|
Packer,
|
||||||
|
PageBreak,
|
||||||
|
Paragraph,
|
||||||
|
TextRun,
|
||||||
|
PageReference,
|
||||||
|
} from "../build";
|
||||||
|
|
||||||
const LOREM_IPSUM =
|
const LOREM_IPSUM =
|
||||||
|
/* cspell:disable-next-line */
|
||||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante.";
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante.";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
|
@ -34,8 +34,7 @@ const doc = new Document({
|
|||||||
new TableCell({
|
new TableCell({
|
||||||
children: [
|
children: [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
text:
|
text: "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
|
||||||
"Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
|
|
||||||
heading: HeadingLevel.HEADING_1,
|
heading: HeadingLevel.HEADING_1,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
// Add image to table cell
|
// Add image to table cell
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build";
|
import { Document, ImageRun, Packer, Paragraph, Table, TableCell, TableRow, WidthType } from "../build";
|
||||||
|
|
||||||
|
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kHx8jHh4jHiEjHiAiHiAiHSAiHx8jHx8jHx8jHiAiHiAiHiAiHSAiHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8jHx8iHiAiHiAiHiAjHx8jHx8jHx8iHx8iHSAiHiAjHiAjHx8jHx8hHx8iHx8iHyAiHiAjHiAjHiAjHh4hHx8iHx8iHx8iHyAjHSAjHiAjHiAjHh4hHx8iHx8iHx8jHyAjHiAhHh4iHx8iHx8jHyAjHSAjHSAhHiAhHh4iHx8iHx8jHx8jHyAjHSAjHSAiHh4iHh4jHx8jHx8jHyAjHyAhHSAhHSAiHh4iHh4jHx8jHx8jHyAhHyAhHSAiHSAiHh4jHh4jHx8jHx8jHyAhHyAhHSAiHSAjHR4jHh4jHx8jHx8hHyAhHyAiHSAjHSAjHR4jHh4jHx8hHx8hHyAhHyAiHyAjHSAjHR4jHR4hHh4hHx8hHyAiHyAjHyAjHSAjHR4jHR4hHh4hHx8hHyAjHyAjHyAjHSAjHR4hHR4hHR4hHx8iHyAjHyAjHyAjHSAhHR4hHR4hHR4hHx8jHyAjHyAjHyAjHyC9S2xeAAAA7nRSTlMAAQIDBAUGBwgJCgsMDQ4PEBESExQVFxgZGhscHR4fICEiIyQlJicoKSorLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZISUpLTE1OUFFSU1RVVllaW1xdXmBhYmNkZWZnaGprbG1ub3Byc3R1dnd4eXp8fn+AgYKDhIWGiImKi4yNj5CRkpOUlZaXmJmam5ydnp+goaKjpKaoqqusra6vsLGys7S1tri5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+fkZpVQAABcBJREFUGBntwftjlQMcBvDnnLNL22qzJjWlKLHFVogyty3SiFq6EZliqZGyhnSxsLlMRahYoZKRFcul5dKFCatYqWZaNKvWtrPz/A2+7/b27qRzec/lPfvl/XxgMplMJpPJZDKZAtA9HJ3ppnIez0KnSdtC0RCNznHdJrbrh85wdSlVVRaEXuoGamYi5K5430HNiTiEWHKJg05eRWgNfKeV7RxbqUhGKPV/207VupQ8is0IoX5vtFC18SqEHaK4GyHTZ2kzVR8PBTCO4oANIZL4ShNVZcOhKKeYg9DoWdhI1ec3os2VFI0JCIUez5+i6st0qJZRrEAIJCw+QdW223BG/EmKwTBc/IJ/qfp2FDrkUnwFo8U9dZyqnaPhxLqfYjyM1S3vb6p+GGOBszsojoTDSDFz6qj66R4LzvYJxVMwUNRjf1H1ywQr/megg2RzLximy8waqvbda8M5iijegVEiHjlM1W/3h+FcXesphsMY4dMOUnUgOxyuPEzxPQwRNvV3qg5Nj4BreyimwADWe/dRVTMjEm6MoGLzGwtystL6RyOY3qSqdlYU3FpLZw1VW0sK5943MvUCKwJ1noNtjs6Ohge76Zq9ZkfpigU5WWkDYuCfbs1U5HWFR8/Qq4a9W0uK5k4ZmdrTCl8spGIePLPlbqqsc1Afe83O0hULc8alDYiBd7ZyitYMeBfR55rR2fOKP6ioPk2dGvZ+UVI0d8rtqT2tcCexlqK2F3wRn5Q+YVbBqrLKOupkr9lZujAOrmS0UpTb4JeIPkNHZ+cXr6uoPk2vyuBSPhWLEKj45PQJuQWryyqP0Z14uGLdROHIRNBEXDR09EP5r62rOHCazhrD4VKPwxTH+sIA3ZPTJ+YuWV22n+IruHFDC8X2CBjnPoolcGc2FYUwzmsUWXDHsoGKLBhmN0VvuBVfTVE/AAbpaid5CB4MbaLY1QXGuIViLTyZQcVyGGMuxWPwaA0Vk2GI9RRp8Ci2iuLkIBjhT5LNUfAspZFiTwyC72KK7+DNg1SsRvCNp3gZXq2k4iEEXSHFJHgVXUlxejCCbTvFAHiXdIJiXxyCK7KJ5FHoMZGK9xBcwyg2QpdlVMxEUM2iyIMuXXZQNF+HswxMsSAAJRQjoE//eoqDCXBSTO6f1xd+O0iyNRY6jaWi1ALNYCocZROj4JdEikroVkjFk9DcStXxpdfCD2MoXodu4RUU9ptxxmXssOfxnvDVcxRTod9FxyhqLoAqis5aPhwTDp9spRgEH2Q6KLbYoKqlaKTm6Isp0C/sJMnjFvhiERXPQvUNRe9p29lhR04CdBpC8Sl8YiuncIxEuzUUg4Dkgj+paVozygY9plPMh28SaymO9kabAopREGF3vt9MzeFFl8G7lRSZ8FFGK8XX4VA8QjEd7XrM3M0OXz8YCy+qKBLgq3wqnofiTorF0Ax56Rg1J1elW+BBAsVe+My6iYq7IK6keBdOIseV2qn5Pb8f3MqkWAXf9ThM8c8lAOIotuFsF875lRrH5klRcG0+xcPwQ1oLxfeRAP4heQTnGL78X2rqlw2DK59SXAV/zKaiGMAuko5InCt68mcOan5+ohf+z1pP8lQY/GHZQMV4YD3FpXDp4qerqbF/lBWBswyi+AL+ia+maLgcRRQj4IYlY/UpauqKBsPJAxQF8NM1TRQ/RudSPAD34rK3scOuR8/HGcspxsJfOVS8NZbiGXiUtPgINU3v3WFDmx8pEuG3EiqKKVbCC1vm2iZqap5LAtCtleQf8F9sFYWDohzeJczYyQ4V2bEZFGsQgJRGqqqhS2phHTWn9lDkIhBTqWqxQZ+IsRvtdHY9AvI2VX2hW68nfqGmuQsCEl3JdjfCF8OW1bPdtwhQ0gm2mQzfRE3a7KCYj0BNZJs8+Kxf/r6WtTEI2FIqlsMfFgRB5A6KUnSe/vUkX0AnuvUIt8SjM1m6wWQymUwmk8lkMgXRf5vi8rLQxtUhAAAAAElFTkSuQmCC`;
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
|
width: {
|
||||||
|
size: 8640,
|
||||||
|
type: WidthType.DXA,
|
||||||
|
},
|
||||||
rows: [
|
rows: [
|
||||||
new TableRow({
|
new TableRow({
|
||||||
children: [
|
children: [
|
||||||
@ -17,7 +23,19 @@ const table = new Table({
|
|||||||
children: [],
|
children: [],
|
||||||
}),
|
}),
|
||||||
new TableCell({
|
new TableCell({
|
||||||
children: [],
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new ImageRun({
|
||||||
|
data: Buffer.from(imageBase64Data, "base64"),
|
||||||
|
transformation: {
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@ -27,7 +45,19 @@ const table = new Table({
|
|||||||
children: [],
|
children: [],
|
||||||
}),
|
}),
|
||||||
new TableCell({
|
new TableCell({
|
||||||
children: [],
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new ImageRun({
|
||||||
|
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
||||||
|
transformation: {
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
new TableCell({
|
new TableCell({
|
||||||
children: [],
|
children: [],
|
||||||
|
@ -123,8 +123,7 @@ const noBorderTable = new Table({
|
|||||||
new TableCell({
|
new TableCell({
|
||||||
children: [
|
children: [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
text:
|
text: "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
|
||||||
"Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
|
|
||||||
heading: HeadingLevel.HEADING_1,
|
heading: HeadingLevel.HEADING_1,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -43,8 +43,7 @@ const doc = new Document({
|
|||||||
style: "strong",
|
style: "strong",
|
||||||
}),
|
}),
|
||||||
new TextRun({
|
new TextRun({
|
||||||
text:
|
text: " - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
||||||
" - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -121,7 +121,7 @@ const doc = new Document({
|
|||||||
author: "Firstname Lastname",
|
author: "Firstname Lastname",
|
||||||
date: "2020-10-06T09:05:00Z",
|
date: "2020-10-06T09:05:00Z",
|
||||||
bold: false,
|
bold: false,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -4,7 +4,7 @@ import * as fs from "fs";
|
|||||||
import { Bookmark, Document, Packer, Paragraph, SimpleField, TextRun } from "../build";
|
import { Bookmark, Document, Packer, Paragraph, SimpleField, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
creator: 'Me',
|
creator: "Me",
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
properties: {},
|
properties: {},
|
||||||
|
@ -13,11 +13,13 @@ const doc = new Document({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
new Paragraph({ children: [
|
new Paragraph({
|
||||||
new TextRun('This text will be in the first column.'),
|
children: [
|
||||||
|
new TextRun("This text will be in the first column."),
|
||||||
new ColumnBreak(),
|
new ColumnBreak(),
|
||||||
new TextRun('This text will be in the second column.'),
|
new TextRun("This text will be in the second column."),
|
||||||
] }),
|
],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
31
demo/74-nodejs-stream.ts
Normal file
31
demo/74-nodejs-stream.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Simple example to add text to a document
|
||||||
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { Document, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
|
const doc = new Document({
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
properties: {},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new TextRun("Hello World"),
|
||||||
|
new TextRun({
|
||||||
|
text: "Foo Bar",
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
new TextRun({
|
||||||
|
text: "\tGithub is the best",
|
||||||
|
bold: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Packer.toStream(doc).then((stream) => {
|
||||||
|
stream.pipe(fs.createWriteStream("My Document.docx"));
|
||||||
|
});
|
@ -27,7 +27,8 @@ import { Document, Packer, Paragraph, TextRun } from "docx";
|
|||||||
// Documents contain sections, you can have multiple sections per document, go here to learn more about sections
|
// Documents contain sections, you can have multiple sections per document, go here to learn more about sections
|
||||||
// This simple example will only contain one section
|
// This simple example will only contain one section
|
||||||
const doc = new Document({
|
const doc = new Document({
|
||||||
sections: [{
|
sections: [
|
||||||
|
{
|
||||||
properties: {},
|
properties: {},
|
||||||
children: [
|
children: [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
@ -44,7 +45,8 @@ const doc = new Document({
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Used to export the file into a .docx file
|
// Used to export the file into a .docx file
|
||||||
@ -56,6 +58,7 @@ Packer.toBuffer(doc).then((buffer) => {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<!-- cspell:disable-next-line -->
|
||||||
<img alt="clippy the assistant" src="./clippy.png">
|
<img alt="clippy the assistant" src="./clippy.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
* [Getting Started](/)
|
- [Getting Started](/)
|
||||||
|
|
||||||
* [Examples](https://github.com/dolanmiu/docx/tree/master/demo)
|
- [Examples](https://github.com/dolanmiu/docx/tree/master/demo)
|
||||||
|
|
||||||
* API
|
- API
|
||||||
|
|
||||||
* [Documentation](https://docx.js.org/api/)
|
- [Documentation](https://docx.js.org/api/)
|
||||||
|
|
||||||
* Usage
|
- Usage
|
||||||
|
|
||||||
* [Document](usage/document.md)
|
- [Document](usage/document.md)
|
||||||
* [Sections](usage/sections.md)
|
- [Sections](usage/sections.md)
|
||||||
* [Paragraph](usage/paragraph.md)
|
- [Paragraph](usage/paragraph.md)
|
||||||
* [Text](usage/text.md)
|
- [Text](usage/text.md)
|
||||||
* [Image](usage/images.md)
|
- [Image](usage/images.md)
|
||||||
* [Headers & Footers](usage/headers-and-footers.md)
|
- [Headers & Footers](usage/headers-and-footers.md)
|
||||||
* [Bullet Points](usage/bullet-points.md)
|
- [Bullet Points](usage/bullet-points.md)
|
||||||
* [Hyperlinks](usage/hyperlinks.md)
|
- [Hyperlinks](usage/hyperlinks.md)
|
||||||
* [Numbering](usage/numbering.md)
|
- [Numbering](usage/numbering.md)
|
||||||
* [Tables](usage/tables.md)
|
- [Tables](usage/tables.md)
|
||||||
* [Tab Stops](usage/tab-stops.md)
|
- [Tab Stops](usage/tab-stops.md)
|
||||||
* [Table of Contents](usage/table-of-contents.md)
|
- [Table of Contents](usage/table-of-contents.md)
|
||||||
* [Page Numbers](usage/page-numbers.md)
|
- [Page Numbers](usage/page-numbers.md)
|
||||||
* [Change Tracking](usage/change-tracking.md)
|
- [Change Tracking](usage/change-tracking.md)
|
||||||
* [Math](usage/math.md)
|
- [Math](usage/math.md)
|
||||||
* [Text Frames](usage/text-frames.md)
|
- [Text Frames](usage/text-frames.md)
|
||||||
* Styling
|
- Styling
|
||||||
* [Styling with JS](usage/styling-with-js.md)
|
_ [Styling with JS](usage/styling-with-js.md)
|
||||||
* [Styling with XML](usage/styling-with-xml.md)
|
_ [Styling with XML](usage/styling-with-xml.md)
|
||||||
* Exporting
|
|
||||||
|
|
||||||
* [Packers](usage/packers.md)
|
- Exporting
|
||||||
* Utility
|
|
||||||
|
|
||||||
* [Convenience functions](usage/convenience-functions.md)
|
- [Packers](usage/packers.md)
|
||||||
|
|
||||||
* [Contribution Guidelines](contribution-guidelines.md)
|
- Utility
|
||||||
|
|
||||||
|
- [Convenience functions](usage/convenience-functions.md)
|
||||||
|
|
||||||
|
- [Contribution Guidelines](contribution-guidelines.md)
|
||||||
|
@ -26,13 +26,15 @@ Please write good commit messages when making a commit: https://chris.beams.io/p
|
|||||||
|
|
||||||
**Do not:**
|
**Do not:**
|
||||||
|
|
||||||
|
<!-- cspell:disable -->
|
||||||
```
|
```
|
||||||
c // What?
|
c // What?
|
||||||
rtl // Adding acryonyms without explaining anything else is not helpful
|
rtl // Adding acronyms without explaining anything else is not helpful
|
||||||
works! // Glad its working, but the message is not helpful
|
works! // Glad its working, but the message is not helpful
|
||||||
demo updated // Getting better, but capitalize the first letter
|
demo updated // Getting better, but capitalize the first letter
|
||||||
Unesesary coment removed // Make sure to use correct spelling
|
Unesesary coment removed // Make sure to use correct spelling
|
||||||
```
|
```
|
||||||
|
<!-- cspell:enable -->
|
||||||
|
|
||||||
**Do**
|
**Do**
|
||||||
|
|
||||||
@ -42,9 +44,9 @@ Unesesary coment removed // Make sure to use correct spelling
|
|||||||
public float(tableFloatOptions: ITableFloatOptions): Table
|
public float(tableFloatOptions: ITableFloatOptions): Table
|
||||||
```
|
```
|
||||||
|
|
||||||
## Delcariative API
|
## Declarative API
|
||||||
|
|
||||||
Make sure the API is declarative, so no _method calling_ or _mutation_. This is a design decision, consistent with the rest of the project. There are benefits to delcariative code over other styles of code, explained here: https://dzone.com/articles/why-declarative-coding-makes-you-a-better-programm
|
Make sure the API is declarative, so no _method calling_ or _mutation_. This is a design decision, consistent with the rest of the project. There are benefits to declarative code over other styles of code, explained here: https://dzone.com/articles/why-declarative-coding-makes-you-a-better-programm
|
||||||
|
|
||||||
**Do not:**
|
**Do not:**
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.$docsify = {
|
window.$docsify = {
|
||||||
name: "docx",
|
name: "docx",
|
||||||
@ -24,6 +25,12 @@
|
|||||||
subMaxLevel: 2,
|
subMaxLevel: 2,
|
||||||
search: "auto",
|
search: "auto",
|
||||||
coverpage: true,
|
coverpage: true,
|
||||||
|
plugins: [
|
||||||
|
// Change to your Carbon property ID
|
||||||
|
// cSpell:disable
|
||||||
|
DocsifyCarbon.create("CEAIP237", "docx"),
|
||||||
|
// cSpell:enable
|
||||||
|
],
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||||
|
@ -37,7 +37,7 @@ sub-sublists, etc. Each level includes the following properties:
|
|||||||
numbers from each numbering level before this one. Thus a level
|
numbers from each numbering level before this one. Thus a level
|
||||||
text of `%d)` with a number format of `lowerLetter` would result in
|
text of `%d)` with a number format of `lowerLetter` would result in
|
||||||
the sequence "a)", "b)", ...
|
the sequence "a)", "b)", ...
|
||||||
* and a few others, which you can see in the OXML spec section 17.9.6
|
* and a few others, which you can see in the OOXML spec section 17.9.6
|
||||||
|
|
||||||
## Document-level bullets/numbering definitions (concrete)
|
## Document-level bullets/numbering definitions (concrete)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ Add borders to a `Paragraph`. Good for making the `Paragraph` stand out
|
|||||||
| -------- | -------- | -------- |
|
| -------- | -------- | -------- |
|
||||||
| color | `string` | Required |
|
| color | `string` | Required |
|
||||||
| space | `number` | Required |
|
| space | `number` | Required |
|
||||||
| value | `string` | Required |
|
| style | `string` | Required |
|
||||||
| size | `number` | Required |
|
| size | `number` | Required |
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
@ -135,13 +135,13 @@ const paragraph = new Paragraph({
|
|||||||
top: {
|
top: {
|
||||||
color: "auto",
|
color: "auto",
|
||||||
space: 1,
|
space: 1,
|
||||||
value: "single",
|
style: "single",
|
||||||
size: 6,
|
size: 6,
|
||||||
},
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
color: "auto",
|
color: "auto",
|
||||||
space: 1,
|
space: 1,
|
||||||
value: "single",
|
style: "single",
|
||||||
size: 6,
|
size: 6,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -146,7 +146,7 @@ const doc = new Document({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: If you are using the `.headingX` or `.title` methods of paragraphs, you must make sure to define `HeadingX` or `Title` styles for these. Otherwise they'll show up unstyled :(. If you are using the `.bullet` or `.setNumbering` methods, you need to define a `ListParagraph` style or the numbers may not show up.
|
**Note**: If you are using the `.headingX` or `.title` methods of paragraphs, you must make sure to define `HeadingX` or `Title` styles for these. Otherwise they'll show up un-styled :(. If you are using the `.bullet` or `.setNumbering` methods, you need to define a `ListParagraph` style or the numbers may not show up.
|
||||||
|
|
||||||
### Document defaults
|
### Document defaults
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ For these properties, the rules state the following conflict resolution in case
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Declaritive styles
|
### Declarative styles
|
||||||
|
|
||||||
Importing Images from file system path
|
Importing Images from file system path
|
||||||
|
|
||||||
|
2494
package-lock.json
generated
2494
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docx",
|
"name": "docx",
|
||||||
"version": "7.3.0",
|
"version": "7.4.1",
|
||||||
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
|
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -14,8 +14,9 @@
|
|||||||
"webpack": "rimraf ./build && webpack --config ./webpack.config.ts",
|
"webpack": "rimraf ./build && webpack --config ./webpack.config.ts",
|
||||||
"demo": "npm run build && npm run ts-node --skip-project ./demo",
|
"demo": "npm run build && npm run ts-node --skip-project ./demo",
|
||||||
"typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
|
"typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json",
|
||||||
"style": "prettier -l \"src/**/*.ts\"",
|
"style": "prettier -l \"{src,scripts,demo}/**/*.{ts,html}\"",
|
||||||
"style.fix": "npm run style -- --write",
|
"style.fix": "npm run style -- --write",
|
||||||
|
"cspell": "cspell \"{src,demo,docs,scripts}/**/*.{ts,scss,html,md}\" && cspell \"./*.*\"",
|
||||||
"fix-types": "ts-node --skip-project scripts/types-absolute-fixer.ts",
|
"fix-types": "ts-node --skip-project scripts/types-absolute-fixer.ts",
|
||||||
"e2e": "ts-node scripts/e2e.ts",
|
"e2e": "ts-node scripts/e2e.ts",
|
||||||
"serve.docs": "cd docs && docsify serve",
|
"serve.docs": "cd docs && docsify serve",
|
||||||
@ -63,7 +64,7 @@
|
|||||||
"homepage": "https://github.com/dolanmiu/docx#readme",
|
"homepage": "https://github.com/dolanmiu/docx#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.2.15",
|
"@types/chai": "^4.2.15",
|
||||||
"@types/glob": "^7.1.4",
|
"@types/glob": "^8.0.0",
|
||||||
"@types/mocha": "^9.0.0",
|
"@types/mocha": "^9.0.0",
|
||||||
"@types/prompt": "^1.1.1",
|
"@types/prompt": "^1.1.1",
|
||||||
"@types/request-promise": "^4.1.42",
|
"@types/request-promise": "^4.1.42",
|
||||||
@ -73,6 +74,7 @@
|
|||||||
"@types/webpack": "^5.0.0",
|
"@types/webpack": "^5.0.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
|
"cspell": "^6.2.2",
|
||||||
"docsify-cli": "^4.3.0",
|
"docsify-cli": "^4.3.0",
|
||||||
"glob": "^8.0.1",
|
"glob": "^8.0.1",
|
||||||
"jszip": "^3.1.5",
|
"jszip": "^3.1.5",
|
||||||
@ -92,9 +94,10 @@
|
|||||||
"ts-loader": "^9.0.0",
|
"ts-loader": "^9.0.0",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"tsconfig-paths": "^4.0.0",
|
"tsconfig-paths": "^4.0.0",
|
||||||
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-immutable": "^6.0.1",
|
"tslint-immutable": "^6.0.1",
|
||||||
"typedoc": "^0.22.3",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "4.7.4",
|
"typescript": "4.7.4",
|
||||||
"unzipper": "^0.10.11",
|
"unzipper": "^0.10.11",
|
||||||
"webpack": "^5.28.0",
|
"webpack": "^5.28.0",
|
||||||
|
@ -6,9 +6,9 @@ const files = glob.sync("build/**/*.d.ts");
|
|||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
replaceInFile({
|
replaceInFile({
|
||||||
files: file,
|
files: file,
|
||||||
from: /"file[a-z/-]*"/gi,
|
from: /"@[a-z/-]*"/gi,
|
||||||
to: (match) => {
|
to: (match) => {
|
||||||
const matchSlug = match.replace(/['"]+/g, "").trim();
|
const matchSlug = match.replace(/['"]+/g, "").replace(/[@]+/g, "").trim();
|
||||||
const levelCount = file.split("/").length - 2;
|
const levelCount = file.split("/").length - 2;
|
||||||
const backLevels = Array(levelCount).fill("../").join("");
|
const backLevels = Array(levelCount).fill("../").join("");
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ import { assert, expect } from "chai";
|
|||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
import { Formatter } from "@export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { Paragraph, TextRun } from "file";
|
import { CoreProperties } from "@file/core-properties";
|
||||||
import { CoreProperties } from "file/core-properties";
|
import { Paragraph, TextRun } from "@file/paragraph";
|
||||||
import { Attributes } from "file/xml-components";
|
import { Attributes } from "@file/xml-components";
|
||||||
|
|
||||||
describe("Formatter", () => {
|
describe("Formatter", () => {
|
||||||
let formatter: Formatter;
|
let formatter: Formatter;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { BaseXmlComponent, IContext, IXmlableObject } from "file/xml-components";
|
import { BaseXmlComponent, IContext, IXmlableObject } from "@file/xml-components";
|
||||||
|
|
||||||
export class Formatter {
|
export class Formatter {
|
||||||
// tslint:disable-next-line: no-object-literal-type-assertion
|
// tslint:disable-next-line: no-object-literal-type-assertion
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Media } from "file";
|
import { Media } from "@file/media";
|
||||||
|
|
||||||
import { ImageReplacer } from "./image-replacer";
|
import { ImageReplacer } from "./image-replacer";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IMediaData, Media } from "file/media";
|
import { IMediaData, Media } from "@file/media";
|
||||||
|
|
||||||
export class ImageReplacer {
|
export class ImageReplacer {
|
||||||
public replace(xmlData: string, mediaData: IMediaData[], offset: number): string {
|
public replace(xmlData: string, mediaData: IMediaData[], offset: number): string {
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
import { File, Footer, Header, Paragraph } from "file";
|
import { File } from "@file/file";
|
||||||
|
import { Footer, Header } from "@file/header";
|
||||||
|
import { ImageRun, Paragraph } from "@file/paragraph";
|
||||||
|
import * as convenienceFunctions from "@util/convenience-functions";
|
||||||
|
|
||||||
import { Compiler } from "./next-compiler";
|
import { Compiler } from "./next-compiler";
|
||||||
|
|
||||||
@ -13,6 +16,14 @@ describe("Compiler", () => {
|
|||||||
compiler = new Compiler();
|
compiler = new Compiler();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
sinon.stub(convenienceFunctions, "uniqueId").callsFake(() => "test");
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
(convenienceFunctions.uniqueId as sinon.SinonStub).restore();
|
||||||
|
});
|
||||||
|
|
||||||
describe("#compile()", () => {
|
describe("#compile()", () => {
|
||||||
it("should pack all the content", async function () {
|
it("should pack all the content", async function () {
|
||||||
this.timeout(99999999);
|
this.timeout(99999999);
|
||||||
@ -109,18 +120,38 @@ describe("Compiler", () => {
|
|||||||
const spy = sinon.spy(compiler["formatter"], "format");
|
const spy = sinon.spy(compiler["formatter"], "format");
|
||||||
|
|
||||||
compiler.compile(file);
|
compiler.compile(file);
|
||||||
expect(spy.callCount).to.equal(12);
|
expect(spy.callCount).to.equal(13);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should work with media datas", () => {
|
it("should work with media datas", () => {
|
||||||
// This test is required because before, there was a case where Document was formatted twice, which was inefficient
|
// This test is required because before, there was a case where Document was formatted twice, which was inefficient
|
||||||
// This also caused issues such as running prepForXml multiple times as format() was ran multiple times.
|
// This also caused issues such as running prepForXml multiple times as format() was ran multiple times.
|
||||||
const paragraph = new Paragraph("");
|
|
||||||
const file = new File({
|
const file = new File({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
properties: {},
|
headers: {
|
||||||
children: [paragraph],
|
default: new Header({
|
||||||
|
children: [new Paragraph("test")],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
footers: {
|
||||||
|
default: new Footer({
|
||||||
|
children: [new Paragraph("test")],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
new Paragraph({
|
||||||
|
children: [
|
||||||
|
new ImageRun({
|
||||||
|
data: Buffer.from("", "base64"),
|
||||||
|
transformation: {
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import * as JSZip from "jszip";
|
import * as JSZip from "jszip";
|
||||||
import * as xml from "xml";
|
import * as xml from "xml";
|
||||||
|
|
||||||
import { File } from "file";
|
import { File } from "@file/file";
|
||||||
|
|
||||||
import { Formatter } from "../formatter";
|
import { Formatter } from "../formatter";
|
||||||
import { ImageReplacer } from "./image-replacer";
|
import { ImageReplacer } from "./image-replacer";
|
||||||
import { NumberingReplacer } from "./numbering-replacer";
|
import { NumberingReplacer } from "./numbering-replacer";
|
||||||
import { PrettityType } from "./packer";
|
import { PrettifyType } from "./packer";
|
||||||
|
|
||||||
interface IXmlifyedFile {
|
interface IXmlifyedFile {
|
||||||
readonly data: string;
|
readonly data: string;
|
||||||
@ -43,7 +44,7 @@ export class Compiler {
|
|||||||
this.numberingReplacer = new NumberingReplacer();
|
this.numberingReplacer = new NumberingReplacer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public compile(file: File, prettifyXml?: boolean | PrettityType): JSZip {
|
public compile(file: File, prettifyXml?: boolean | PrettifyType): JSZip {
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
|
||||||
const map = new Map<string, IXmlifyedFile | IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
|
const map = new Map<string, IXmlifyedFile | IXmlifyedFile[]>(Object.entries(xmlifiedFileMapping));
|
||||||
@ -66,7 +67,7 @@ export class Compiler {
|
|||||||
return zip;
|
return zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
private xmlifyFile(file: File, prettify?: boolean | PrettityType): IXmlifyedFileMapping {
|
private xmlifyFile(file: File, prettify?: boolean | PrettifyType): IXmlifyedFileMapping {
|
||||||
const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1;
|
const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1;
|
||||||
|
|
||||||
const documentXmlData = xml(
|
const documentXmlData = xml(
|
||||||
@ -405,12 +406,7 @@ export class Compiler {
|
|||||||
path: "word/settings.xml",
|
path: "word/settings.xml",
|
||||||
},
|
},
|
||||||
Comments: {
|
Comments: {
|
||||||
data: (() => {
|
data: xml(
|
||||||
if (!file.Comments) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = xml(
|
|
||||||
this.formatter.format(file.Comments, {
|
this.formatter.format(file.Comments, {
|
||||||
viewWrapper: file.Document,
|
viewWrapper: file.Document,
|
||||||
file,
|
file,
|
||||||
@ -422,9 +418,7 @@ export class Compiler {
|
|||||||
encoding: "UTF-8",
|
encoding: "UTF-8",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
return data;
|
|
||||||
})(),
|
|
||||||
path: "word/comments.xml",
|
path: "word/comments.xml",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ConcreteNumbering } from "file";
|
import { ConcreteNumbering } from "@file/numbering";
|
||||||
|
|
||||||
export class NumberingReplacer {
|
export class NumberingReplacer {
|
||||||
public replace(xmlData: string, concreteNumberings: ConcreteNumbering[]): string {
|
public replace(xmlData: string, concreteNumberings: ConcreteNumbering[]): string {
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
import { assert } from "chai";
|
import { assert } from "chai";
|
||||||
import { mock, stub } from "sinon";
|
import { mock, stub } from "sinon";
|
||||||
|
|
||||||
import { File, HeadingLevel, Paragraph } from "file";
|
import { File } from "@file/file";
|
||||||
|
import { HeadingLevel, Paragraph } from "@file/paragraph";
|
||||||
|
|
||||||
import { Packer } from "./packer";
|
import { Packer } from "./packer";
|
||||||
|
|
||||||
@ -36,6 +37,14 @@ describe("Packer", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("#toString()", () => {
|
||||||
|
it("should return a non-empty string", async () => {
|
||||||
|
const result = await Packer.toString(file);
|
||||||
|
|
||||||
|
assert.isAbove(result.length, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("#toBuffer()", () => {
|
describe("#toBuffer()", () => {
|
||||||
it("should create a standard docx file", async function () {
|
it("should create a standard docx file", async function () {
|
||||||
this.timeout(99999999);
|
this.timeout(99999999);
|
||||||
@ -113,4 +122,52 @@ describe("Packer", () => {
|
|||||||
(Packer as any).compiler.compile.restore();
|
(Packer as any).compiler.compile.restore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("#toStream()", () => {
|
||||||
|
it("should create a standard docx file", async () => {
|
||||||
|
// tslint:disable-next-line: no-any
|
||||||
|
stub((Packer as any).compiler, "compile").callsFake(() => ({
|
||||||
|
// tslint:disable-next-line: no-empty
|
||||||
|
generateNodeStream: () => ({
|
||||||
|
on: (event: string, cb: () => void) => {
|
||||||
|
if (event === "end") {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
const stream = await Packer.toStream(file);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
stream.on("error", () => {
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on("end", () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should handle exception if it throws any", async () => {
|
||||||
|
// tslint:disable-next-line:no-any
|
||||||
|
const compiler = stub((Packer as any).compiler, "compile").callsFake(() => ({
|
||||||
|
// tslint:disable-next-line: no-empty
|
||||||
|
on: (event: string, cb: () => void) => {
|
||||||
|
if (event === "error") {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
compiler.throwsException();
|
||||||
|
return Packer.toStream(file).catch((error) => {
|
||||||
|
assert.isDefined(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
// tslint:disable-next-line:no-any
|
||||||
|
(Packer as any).compiler.compile.restore();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { File } from "file";
|
import { File } from "@file/file";
|
||||||
|
import { Stream } from "stream";
|
||||||
|
|
||||||
import { Compiler } from "./next-compiler";
|
import { Compiler } from "./next-compiler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use blanks to prettify
|
* Use blanks to prettify
|
||||||
*/
|
*/
|
||||||
export enum PrettityType {
|
export enum PrettifyType {
|
||||||
NONE = "",
|
NONE = "",
|
||||||
WITH_2_BLANKS = " ",
|
WITH_2_BLANKS = " ",
|
||||||
WITH_4_BLANKS = " ",
|
WITH_4_BLANKS = " ",
|
||||||
@ -12,7 +14,18 @@ export enum PrettityType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Packer {
|
export class Packer {
|
||||||
public static async toBuffer(file: File, prettify?: boolean | PrettityType): Promise<Buffer> {
|
public static async toString(file: File, prettify?: boolean | PrettifyType): Promise<string> {
|
||||||
|
const zip = this.compiler.compile(file, prettify);
|
||||||
|
const zipData = await zip.generateAsync({
|
||||||
|
type: "string",
|
||||||
|
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
|
compression: "DEFLATE",
|
||||||
|
});
|
||||||
|
|
||||||
|
return zipData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async toBuffer(file: File, prettify?: boolean | PrettifyType): Promise<Buffer> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "nodebuffer",
|
type: "nodebuffer",
|
||||||
@ -23,7 +36,7 @@ export class Packer {
|
|||||||
return zipData;
|
return zipData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async toBase64String(file: File, prettify?: boolean | PrettityType): Promise<string> {
|
public static async toBase64String(file: File, prettify?: boolean | PrettifyType): Promise<string> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "base64",
|
type: "base64",
|
||||||
@ -34,7 +47,7 @@ export class Packer {
|
|||||||
return zipData;
|
return zipData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async toBlob(file: File, prettify?: boolean | PrettityType): Promise<Blob> {
|
public static async toBlob(file: File, prettify?: boolean | PrettifyType): Promise<Blob> {
|
||||||
const zip = this.compiler.compile(file, prettify);
|
const zip = this.compiler.compile(file, prettify);
|
||||||
const zipData = await zip.generateAsync({
|
const zipData = await zip.generateAsync({
|
||||||
type: "blob",
|
type: "blob",
|
||||||
@ -45,5 +58,17 @@ export class Packer {
|
|||||||
return zipData;
|
return zipData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async toStream(file: File, prettify?: boolean | PrettifyType): Promise<Stream> {
|
||||||
|
const zip = this.compiler.compile(file, prettify);
|
||||||
|
const zipData = zip.generateNodeStream({
|
||||||
|
type: "nodebuffer",
|
||||||
|
streamFiles: true,
|
||||||
|
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
|
compression: "DEFLATE",
|
||||||
|
});
|
||||||
|
|
||||||
|
return zipData;
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly compiler = new Compiler();
|
private static readonly compiler = new Compiler();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class AppPropertiesAttributes extends XmlAttributeComponent<{
|
export class AppPropertiesAttributes extends XmlAttributeComponent<{
|
||||||
readonly xmlns: string;
|
readonly xmlns: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { AppPropertiesAttributes } from "./app-properties-attributes";
|
import { AppPropertiesAttributes } from "./app-properties-attributes";
|
||||||
|
|
||||||
export class AppProperties extends XmlComponent {
|
export class AppProperties extends XmlComponent {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { BorderStyle } from "file/border";
|
import { BorderStyle } from "@file/border";
|
||||||
|
|
||||||
import { BorderElement } from "./border";
|
import { BorderElement } from "./border";
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
// <xsd:attribute name="shadow" type="s:ST_OnOff" use="optional"/>
|
// <xsd:attribute name="shadow" type="s:ST_OnOff" use="optional"/>
|
||||||
// <xsd:attribute name="frame" type="s:ST_OnOff" use="optional"/>
|
// <xsd:attribute name="frame" type="s:ST_OnOff" use="optional"/>
|
||||||
// </xsd:complexType>
|
// </xsd:complexType>
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { eighthPointMeasureValue, hexColorValue, pointMeasureValue } from "../values";
|
import { eighthPointMeasureValue, hexColorValue, pointMeasureValue } from "@util/values";
|
||||||
|
|
||||||
export interface IBorderOptions {
|
export interface IBorderOptions {
|
||||||
readonly style: BorderStyle;
|
readonly style: BorderStyle;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class ContentTypeAttributes extends XmlAttributeComponent<{
|
export class ContentTypeAttributes extends XmlAttributeComponent<{
|
||||||
readonly xmlns?: string;
|
readonly xmlns?: string;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { ContentTypes } from "./content-types";
|
import { ContentTypes } from "./content-types";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { ContentTypeAttributes } from "./content-types-attributes";
|
import { ContentTypeAttributes } from "./content-types-attributes";
|
||||||
import { Default } from "./default/default";
|
import { Default } from "./default/default";
|
||||||
import { Override } from "./override/override";
|
import { Override } from "./override/override";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class DefaultAttributes extends XmlAttributeComponent<{
|
export class DefaultAttributes extends XmlAttributeComponent<{
|
||||||
readonly contentType: string;
|
readonly contentType: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { DefaultAttributes } from "./default-attributes";
|
import { DefaultAttributes } from "./default-attributes";
|
||||||
|
|
||||||
export class Default extends XmlComponent {
|
export class Default extends XmlComponent {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class OverrideAttributes extends XmlAttributeComponent<{
|
export class OverrideAttributes extends XmlAttributeComponent<{
|
||||||
readonly contentType: string;
|
readonly contentType: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { OverrideAttributes } from "./override-attributes";
|
import { OverrideAttributes } from "./override-attributes";
|
||||||
|
|
||||||
export class Override extends XmlComponent {
|
export class Override extends XmlComponent {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { CoreProperties } from "./properties";
|
import { CoreProperties } from "./properties";
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ICommentsOptions } from "file/paragraph/run/comment-run";
|
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
|
||||||
import { StringContainer, XmlComponent } from "file/xml-components";
|
import { StringContainer, XmlComponent } from "@file/xml-components";
|
||||||
|
import { dateTimeValue } from "@util/values";
|
||||||
|
|
||||||
import { ICustomPropertyOptions } from "../custom-properties";
|
import { ICustomPropertyOptions } from "../custom-properties";
|
||||||
import { IDocumentBackgroundOptions } from "../document";
|
import { IDocumentBackgroundOptions } from "../document";
|
||||||
@ -9,7 +10,6 @@ import { ISectionOptions } from "../file";
|
|||||||
import { INumberingOptions } from "../numbering";
|
import { INumberingOptions } from "../numbering";
|
||||||
import { Paragraph } from "../paragraph";
|
import { Paragraph } from "../paragraph";
|
||||||
import { IStylesOptions } from "../styles";
|
import { IStylesOptions } from "../styles";
|
||||||
import { dateTimeValue } from "../values";
|
|
||||||
|
|
||||||
export interface IPropertiesOptions {
|
export interface IPropertiesOptions {
|
||||||
readonly sections: ISectionOptions[];
|
readonly sections: ISectionOptions[];
|
||||||
@ -41,6 +41,7 @@ export interface IPropertiesOptions {
|
|||||||
|
|
||||||
// <xs:element name="coreProperties" type="CT_CoreProperties"/>
|
// <xs:element name="coreProperties" type="CT_CoreProperties"/>
|
||||||
|
|
||||||
|
/* cSpell:disable */
|
||||||
// <xs:complexType name="CT_CoreProperties">
|
// <xs:complexType name="CT_CoreProperties">
|
||||||
// <xs:all>
|
// <xs:all>
|
||||||
// <xs:element name="category" minOccurs="0" maxOccurs="1" type="xs:string"/>
|
// <xs:element name="category" minOccurs="0" maxOccurs="1" type="xs:string"/>
|
||||||
@ -60,6 +61,7 @@ export interface IPropertiesOptions {
|
|||||||
// <xs:element name="version" minOccurs="0" maxOccurs="1" type="xs:string"/>
|
// <xs:element name="version" minOccurs="0" maxOccurs="1" type="xs:string"/>
|
||||||
// </xs:all>
|
// </xs:all>
|
||||||
// </xs:complexType>
|
// </xs:complexType>
|
||||||
|
/* cSpell:enable */
|
||||||
|
|
||||||
export class CoreProperties extends XmlComponent {
|
export class CoreProperties extends XmlComponent {
|
||||||
constructor(options: Omit<IPropertiesOptions, "sections">) {
|
constructor(options: Omit<IPropertiesOptions, "sections">) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class CustomPropertiesAttributes extends XmlAttributeComponent<{
|
export class CustomPropertiesAttributes extends XmlAttributeComponent<{
|
||||||
readonly xmlns: string;
|
readonly xmlns: string;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import { Formatter } from "export/formatter";
|
|
||||||
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { CustomProperties } from "./custom-properties";
|
import { CustomProperties } from "./custom-properties";
|
||||||
|
|
||||||
describe("CustomProperties", () => {
|
describe("CustomProperties", () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IContext, IXmlableObject, XmlComponent } from "file/xml-components";
|
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||||
import { CustomPropertiesAttributes } from "./custom-properties-attributes";
|
import { CustomPropertiesAttributes } from "./custom-properties-attributes";
|
||||||
import { CustomProperty, ICustomPropertyOptions } from "./custom-property";
|
import { CustomProperty, ICustomPropertyOptions } from "./custom-property";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class CustomPropertyAttributes extends XmlAttributeComponent<{
|
export class CustomPropertyAttributes extends XmlAttributeComponent<{
|
||||||
readonly fmtid: string;
|
readonly fmtid: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { CustomPropertyAttributes } from "./custom-property-attributes";
|
import { CustomPropertyAttributes } from "./custom-property-attributes";
|
||||||
|
|
||||||
export interface ICustomPropertyOptions {
|
export interface ICustomPropertyOptions {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { Body } from "./body";
|
import { Body } from "./body";
|
||||||
import { sectionMarginDefaults } from "./section-properties";
|
import { sectionMarginDefaults } from "./section-properties";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { IContext, IXmlableObject, XmlComponent } from "file/xml-components";
|
import { Paragraph, ParagraphProperties } from "@file/paragraph";
|
||||||
|
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
import { Paragraph, ParagraphProperties } from "../..";
|
|
||||||
import { ISectionPropertiesOptions, SectionProperties } from "./section-properties/section-properties";
|
import { ISectionPropertiesOptions, SectionProperties } from "./section-properties/section-properties";
|
||||||
|
|
||||||
export class Body extends XmlComponent {
|
export class Body extends XmlComponent {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { twipsMeasureValue } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { twipsMeasureValue } from "@util/values";
|
||||||
|
|
||||||
export interface IColumnAttributes {
|
export interface IColumnAttributes {
|
||||||
readonly width: number | string;
|
readonly width: number | string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { Column, Columns } from ".";
|
import { Column, Columns } from ".";
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { decimalNumber, twipsMeasureValue } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { decimalNumber, twipsMeasureValue } from "@util/values";
|
||||||
|
|
||||||
import { Column } from "./column";
|
import { Column } from "./column";
|
||||||
|
|
||||||
// <xsd:complexType name="CT_Columns">
|
// <xsd:complexType name="CT_Columns">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { DocumentGrid, DocumentGridType } from ".";
|
import { DocumentGrid, DocumentGridType } from ".";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { decimalNumber } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { decimalNumber } from "@util/values";
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
// <xsd:simpleType name="ST_DocGrid">
|
// <xsd:simpleType name="ST_DocGrid">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./header-footer-reference";
|
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./header-footer-reference";
|
||||||
|
|
||||||
describe("HeaderFooterReference", () => {
|
describe("HeaderFooterReference", () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_HdrFtr">
|
// <xsd:simpleType name="ST_HdrFtr">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/WPsectionLineNumbering.php
|
// http://officeopenxml.com/WPsectionLineNumbering.php
|
||||||
import { decimalNumber, twipsMeasureValue } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { decimalNumber, twipsMeasureValue } from "@util/values";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_LineNumberRestart">
|
// <xsd:simpleType name="ST_LineNumberRestart">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { BorderStyle } from "file/border";
|
import { BorderStyle } from "@file/border";
|
||||||
|
|
||||||
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
|
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/WPsectionBorders.php
|
// http://officeopenxml.com/WPsectionBorders.php
|
||||||
import { BorderElement, IBorderOptions } from "file/border";
|
import { BorderElement, IBorderOptions } from "@file/border";
|
||||||
import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent } from "file/xml-components";
|
import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_PageBorderDisplay">
|
// <xsd:simpleType name="ST_PageBorderDisplay">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { signedTwipsMeasureValue, twipsMeasureValue } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
|
||||||
|
|
||||||
// <xsd:complexType name="CT_PageMar">
|
// <xsd:complexType name="CT_PageMar">
|
||||||
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>
|
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// http://officeopenxml.com/WPSectionPgNumType.php
|
// http://officeopenxml.com/WPSectionPgNumType.php
|
||||||
import { NumberFormat } from "file/shared/number-format";
|
import { NumberFormat } from "@file/shared/number-format";
|
||||||
import { decimalNumber } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { decimalNumber } from "@util/values";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_ChapterSep">
|
// <xsd:simpleType name="ST_ChapterSep">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { PageOrientation, PageSize } from "./page-size";
|
import { PageOrientation, PageSize } from "./page-size";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { twipsMeasureValue } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { twipsMeasureValue } from "@util/values";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_PageOrientation">
|
// <xsd:simpleType name="ST_PageOrientation">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { PageTextDirection, PageTextDirectionType } from "./page-text-direction";
|
import { PageTextDirection, PageTextDirectionType } from "./page-text-direction";
|
||||||
|
|
||||||
describe("PageTextDirection", () => {
|
describe("PageTextDirection", () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export enum PageTextDirectionType {
|
export enum PageTextDirectionType {
|
||||||
LEFT_TO_RIGHT_TOP_TO_BOTTOM = "lrTb",
|
LEFT_TO_RIGHT_TOP_TO_BOTTOM = "lrTb",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { SectionType, Type } from "./section-type";
|
import { SectionType, Type } from "./section-type";
|
||||||
|
|
||||||
describe("Type", () => {
|
describe("Type", () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// http://officeopenxml.com/WPsection.php
|
// http://officeopenxml.com/WPsection.php
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_SectionMark">
|
// <xsd:simpleType name="ST_SectionMark">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { convertInchesToTwip } from "convenience-functions";
|
import { Formatter } from "@export/formatter";
|
||||||
import { Formatter } from "export/formatter";
|
import { FooterWrapper } from "@file/footer-wrapper";
|
||||||
import { FooterWrapper } from "file/footer-wrapper";
|
import { HeaderWrapper } from "@file/header-wrapper";
|
||||||
import { HeaderWrapper } from "file/header-wrapper";
|
import { Media } from "@file/media";
|
||||||
import { Media } from "file/media";
|
import { NumberFormat } from "@file/shared/number-format";
|
||||||
import { NumberFormat } from "file/shared/number-format";
|
import { VerticalAlign } from "@file/vertical-align";
|
||||||
import { VerticalAlign } from "file/vertical-align";
|
import { convertInchesToTwip } from "@util/convenience-functions";
|
||||||
|
|
||||||
import { PageOrientation } from "./properties";
|
import { PageOrientation } from "./properties";
|
||||||
import { DocumentGridType } from "./properties/doc-grid";
|
import { DocumentGridType } from "./properties/doc-grid";
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// http://officeopenxml.com/WPsection.php
|
// http://officeopenxml.com/WPsection.php
|
||||||
// tslint:disable: no-unnecessary-initializer
|
// tslint:disable: no-unnecessary-initializer
|
||||||
|
|
||||||
import { FooterWrapper } from "file/footer-wrapper";
|
import { FooterWrapper } from "@file/footer-wrapper";
|
||||||
import { HeaderWrapper } from "file/header-wrapper";
|
import { HeaderWrapper } from "@file/header-wrapper";
|
||||||
import { VerticalAlign, VerticalAlignElement } from "file/vertical-align";
|
import { VerticalAlign, VerticalAlignElement } from "@file/vertical-align";
|
||||||
import { OnOffElement, XmlComponent } from "file/xml-components";
|
import { OnOffElement, XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
|
/* cSpell:disable */
|
||||||
export interface IDocumentAttributesProperties {
|
export interface IDocumentAttributesProperties {
|
||||||
readonly wpc?: string;
|
readonly wpc?: string;
|
||||||
readonly mc?: string;
|
readonly mc?: string;
|
||||||
@ -41,6 +42,7 @@ export interface IDocumentAttributesProperties {
|
|||||||
readonly w16sdtdh?: string;
|
readonly w16sdtdh?: string;
|
||||||
readonly w16se?: string;
|
readonly w16se?: string;
|
||||||
}
|
}
|
||||||
|
/* cSpell:enable */
|
||||||
|
|
||||||
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
||||||
protected readonly xmlKeys = {
|
protected readonly xmlKeys = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { DocumentBackground } from "./document-background";
|
import { DocumentBackground } from "./document-background";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// http://officeopenxml.com/WPdocument.php
|
// http://officeopenxml.com/WPdocument.php
|
||||||
// http://www.datypic.com/sc/ooxml/e-w_background-1.html
|
// http://www.datypic.com/sc/ooxml/e-w_background-1.html
|
||||||
import { hexColorValue, uCharHexNumber } from "file/values";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { hexColorValue, uCharHexNumber } from "@util/values";
|
||||||
|
|
||||||
// <xsd:simpleType name="ST_ThemeColor">
|
// <xsd:simpleType name="ST_ThemeColor">
|
||||||
// <xsd:restriction base="xsd:string">
|
// <xsd:restriction base="xsd:string">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { Document } from "./document";
|
import { Document } from "./document";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// http://officeopenxml.com/WPdocument.php
|
// http://officeopenxml.com/WPdocument.php
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { ConcreteHyperlink, Paragraph } from "../paragraph";
|
import { ConcreteHyperlink, Paragraph } from "../paragraph";
|
||||||
import { Table } from "../table";
|
import { Table } from "../table";
|
||||||
import { TableOfContents } from "../table-of-contents";
|
import { TableOfContents } from "../table-of-contents";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
import { IDistance } from "../drawing";
|
import { IDistance } from "../drawing";
|
||||||
|
|
||||||
export interface IAnchorAttributes extends IDistance {
|
export interface IAnchorAttributes extends IDistance {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating.php
|
// http://officeopenxml.com/drwPicFloating.php
|
||||||
import { IMediaData, IMediaDataTransformation } from "file/media";
|
import { IMediaData, IMediaDataTransformation } from "@file/media";
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { IDrawingOptions } from "../drawing";
|
import { IDrawingOptions } from "../drawing";
|
||||||
import { HorizontalPosition, IFloating, SimplePos, VerticalPosition } from "../floating";
|
import { HorizontalPosition, IFloating, SimplePos, VerticalPosition } from "../floating";
|
||||||
import { Graphic } from "../inline/graphic";
|
import { Graphic } from "../inline/graphic";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class DocPropertiesAttributes extends XmlAttributeComponent<{
|
export class DocPropertiesAttributes extends XmlAttributeComponent<{
|
||||||
readonly id?: number;
|
readonly id?: number;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { DocPropertiesAttributes } from "./doc-properties-attributes";
|
import { DocPropertiesAttributes } from "./doc-properties-attributes";
|
||||||
|
|
||||||
export class DocProperties extends XmlComponent {
|
export class DocProperties extends XmlComponent {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { Drawing, IDrawingOptions } from "./drawing";
|
import { Drawing, IDrawingOptions } from "./drawing";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { IMediaData } from "file/media";
|
import { IMediaData } from "@file/media";
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { Anchor } from "./anchor";
|
import { Anchor } from "./anchor";
|
||||||
import { IFloating } from "./floating";
|
import { IFloating } from "./floating";
|
||||||
import { Inline } from "./inline";
|
import { Inline } from "./inline";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class EffectExtentAttributes extends XmlAttributeComponent<{
|
export class EffectExtentAttributes extends XmlAttributeComponent<{
|
||||||
readonly b?: number;
|
readonly b?: number;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
import { EffectExtentAttributes } from "./effect-extent-attributes";
|
import { EffectExtentAttributes } from "./effect-extent-attributes";
|
||||||
|
|
||||||
export class EffectExtent extends XmlComponent {
|
export class EffectExtent extends XmlComponent {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlAttributeComponent } from "file/xml-components";
|
import { XmlAttributeComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class ExtentAttributes extends XmlAttributeComponent<{
|
export class ExtentAttributes extends XmlAttributeComponent<{
|
||||||
readonly cx?: number;
|
readonly cx?: number;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
import { ExtentAttributes } from "./extent-attributes";
|
import { ExtentAttributes } from "./extent-attributes";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { VerticalPositionAlign } from "file/shared/alignment";
|
import { VerticalPositionAlign } from "@file/shared/alignment";
|
||||||
|
|
||||||
import { Align } from "./align";
|
import { Align } from "./align";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating-position.php
|
// http://officeopenxml.com/drwPicFloating-position.php
|
||||||
import { HorizontalPositionAlign, VerticalPositionAlign } from "file/shared/alignment";
|
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/alignment";
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class Align extends XmlComponent {
|
export class Align extends XmlComponent {
|
||||||
constructor(value: HorizontalPositionAlign | VerticalPositionAlign) {
|
constructor(value: HorizontalPositionAlign | VerticalPositionAlign) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating-position.php
|
// http://officeopenxml.com/drwPicFloating-position.php
|
||||||
// http://officeopenxml.com/drwPicFloating.php
|
// http://officeopenxml.com/drwPicFloating.php
|
||||||
import { HorizontalPositionAlign, VerticalPositionAlign } from "file/shared/alignment";
|
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/alignment";
|
||||||
|
|
||||||
import { ITextWrapping } from "../text-wrap";
|
import { ITextWrapping } from "../text-wrap";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
import { HorizontalPositionAlign } from "file/shared/alignment";
|
import { HorizontalPositionAlign } from "@file/shared/alignment";
|
||||||
|
|
||||||
import { HorizontalPositionRelativeFrom } from "./floating-position";
|
import { HorizontalPositionRelativeFrom } from "./floating-position";
|
||||||
import { HorizontalPosition } from "./horizontal-position";
|
import { HorizontalPosition } from "./horizontal-position";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating-position.php
|
// http://officeopenxml.com/drwPicFloating-position.php
|
||||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||||
import { Align } from "./align";
|
import { Align } from "./align";
|
||||||
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
||||||
import { PositionOffset } from "./position-offset";
|
import { PositionOffset } from "./position-offset";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { PositionOffset } from "./position-offset";
|
import { PositionOffset } from "./position-offset";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// http://officeopenxml.com/drwPicFloating-position.php
|
// http://officeopenxml.com/drwPicFloating-position.php
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "@file/xml-components";
|
||||||
|
|
||||||
export class PositionOffset extends XmlComponent {
|
export class PositionOffset extends XmlComponent {
|
||||||
constructor(offsetValue: number) {
|
constructor(offsetValue: number) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { Formatter } from "export/formatter";
|
import { Formatter } from "@export/formatter";
|
||||||
|
|
||||||
import { SimplePos } from "./simple-pos";
|
import { SimplePos } from "./simple-pos";
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user