diff --git a/.cspell.json b/.cspell.json index 4d88d4de47..a6ca74d477 100644 --- a/.cspell.json +++ b/.cspell.json @@ -29,15 +29,17 @@ "jszip", "rsid", "NUMPAGES", - "ATLEAST" + "ATLEAST", + "ooxml", + "clippy" ], "ignoreRegExpList": [ - "/w:.+/", - "/s:.+/", - "/a:.+/", - "/pic:.+/", - "/xmlns:.+/", - "/vt:.+/", + "/\"w:.+\"/", + "/\"s:.+\"/", + "/\"a:.+\"/", + "/\"pic:.+\"/", + "/\"xmlns:.+\"/", + "/\"vt:.+\"/", "/[^\\s]{40,}/", "//", "/[A-Z_]+ = \".+\"/", @@ -47,6 +49,7 @@ "\\.to\\.include\\.members\\(\\[[^\\]]+]\\)", "/new [a-zA-Z]+\\({[^£]+}\\)/g" ], + "ignorePaths": ["package.json"], "allowCompoundWords": true, // flagWords - list of words to be always considered incorrect // This is useful for offensive words and common spelling errors. diff --git a/README.md b/README.md index c7218f9215..c6d38a9409 100644 --- a/README.md +++ b/README.md @@ -26,21 +26,21 @@ Here are examples of `docx` being used with basic `HTML/JS` in a browser environment: -* https://codepen.io/dolanmiu/pen/RwNeObg -* https://jsfiddle.net/dolanmiu/onadx1gu/ +- https://codepen.io/dolanmiu/pen/RwNeObg +- https://jsfiddle.net/dolanmiu/onadx1gu/ 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`: -* https://stackblitz.com/edit/react-docx -* https://stackblitz.com/edit/react-docx-images (adding images to Word Document) +- https://stackblitz.com/edit/react-docx +- https://stackblitz.com/edit/react-docx-images (adding images to Word Document) Here is an example of `docx` working in `Vue.js`: -* https://stackblitz.com/edit/vuejs-docx +- https://stackblitz.com/edit/vuejs-docx ## Node @@ -48,15 +48,15 @@ Press `endpoint` on the `RunKit` website: ![RunKit Instructions](https://user-images.githubusercontent.com/2917613/38582539-f84311b6-3d07-11e8-90db-5885ae02c3c4.png) -* 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-demo3 - Bullet points -* https://runkit.com/dolanmiu/docx-demo4 - Simple table -* https://runkit.com/dolanmiu/docx-demo5 - Images -* https://runkit.com/dolanmiu/docx-demo6 - Margins -* https://runkit.com/dolanmiu/docx-demo7 - Landscape -* 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-demo1 - Simple paragraph 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-demo4 - Simple table +- https://runkit.com/dolanmiu/docx-demo5 - Images +- https://runkit.com/dolanmiu/docx-demo6 - Margins +- https://runkit.com/dolanmiu/docx-demo7 - Landscape +- https://runkit.com/dolanmiu/docx-demo8 - Header and Footer +- https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx** 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 [drawing](https://www.circadianrisk.com/) [drawing](https://lexense.com/) - ...and many more! --- diff --git a/demo/10-my-cv.ts b/demo/10-my-cv.ts index 2a3f6bbabf..ef766d6656 100644 --- a/demo/10-my-cv.ts +++ b/demo/10-my-cv.ts @@ -43,7 +43,7 @@ interface Skill { readonly name: string; } -interface Achivement { +interface Achievement { readonly issuer: string; readonly name: string; } @@ -64,7 +64,7 @@ const experiences: Experience[] = [ { isCurrent: false, 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", endDate: { month: 11, @@ -98,6 +98,7 @@ const experiences: Experience[] = [ { isCurrent: false, 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.", title: "Java Developer", endDate: { @@ -118,7 +119,7 @@ const education: Education[] = [ { degree: "Master of Science (MSc)", 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", startDate: { year: 2012, @@ -156,7 +157,7 @@ const skills: Skill[] = [ }, ]; -const achievements: Achivement[] = [ +const achievements: Achievement[] = [ { issuer: "Oracle", name: "Oracle Certified Expert", @@ -165,7 +166,7 @@ const achievements: Achivement[] = [ class DocumentCreator { // 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({ sections: [ { @@ -221,7 +222,7 @@ class DocumentCreator { this.createSubHeading("Skills"), this.createSkillList(skills), this.createSubHeading("Achievements"), - ...this.createAchivementsList(achivements), + ...this.createAchievementsList(achievements), this.createSubHeading("Interests"), this.createInterests("Programming, Technology, Music Production, Web Design, 3D Modelling, Dancing."), this.createHeading("References"), @@ -318,8 +319,8 @@ class DocumentCreator { } // tslint:disable-next-line:no-any - public createAchivementsList(achivements: any[]): Paragraph[] { - return achivements.map( + public createAchievementsList(achievements: any[]): Paragraph[] { + return achievements.map( (achievement) => new Paragraph({ text: achievement.name, diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index 6af4120574..11e306b07e 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -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 * as fs from "fs"; import { diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts index decb882be0..5ae3a35ec3 100644 --- a/demo/21-bookmarks.ts +++ b/demo/21-bookmarks.ts @@ -1,9 +1,21 @@ // This demo shows how to create bookmarks then link to them with internal hyperlinks // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { 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 = + /* 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."; const doc = new Document({ diff --git a/docs/README.md b/docs/README.md index 6e06856207..36a857d6c6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,24 +27,26 @@ import { Document, Packer, Paragraph, TextRun } from "docx"; // 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 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, - }), - ], - }), - ], - }], + 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, + }), + ], + }), + ], + }, + ], }); // Used to export the file into a .docx file @@ -56,6 +58,7 @@ Packer.toBuffer(doc).then((buffer) => { ```

+ clippy the assistant

diff --git a/docs/contribution-guidelines.md b/docs/contribution-guidelines.md index cec4f4a80b..1923a47341 100644 --- a/docs/contribution-guidelines.md +++ b/docs/contribution-guidelines.md @@ -26,13 +26,15 @@ Please write good commit messages when making a commit: https://chris.beams.io/p **Do not:** + ``` 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 demo updated // Getting better, but capitalize the first letter Unesesary coment removed // Make sure to use correct spelling ``` + **Do** @@ -42,9 +44,9 @@ Unesesary coment removed // Make sure to use correct spelling 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:** diff --git a/docs/usage/numbering.md b/docs/usage/numbering.md index e4c10b5d83..6203c3bb4b 100644 --- a/docs/usage/numbering.md +++ b/docs/usage/numbering.md @@ -37,7 +37,7 @@ sub-sublists, etc. Each level includes the following properties: numbers from each numbering level before this one. Thus a level text of `%d)` with a number format of `lowerLetter` would result in 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) diff --git a/docs/usage/styling-with-js.md b/docs/usage/styling-with-js.md index 0dafac2904..e53bffee8d 100644 --- a/docs/usage/styling-with-js.md +++ b/docs/usage/styling-with-js.md @@ -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 @@ -199,7 +199,7 @@ For these properties, the rules state the following conflict resolution in case ## Examples -### Declaritive styles +### Declarative styles Importing Images from file system path diff --git a/package.json b/package.json index 240f08677e..dff1fc375a 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "webpack": "rimraf ./build && webpack --config ./webpack.config.ts", "demo": "npm run build && npm run ts-node --skip-project ./demo", "typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json", - "style": "prettier -l \"src/**/*.ts\"", + "style": "prettier -l \"src/**/*.{ts,html,md}\"", "style.fix": "npm run style -- --write", - "cspell": "cspell \"src/**/*.ts\" && cspell \"demo/**/*.{ts,scss,html}\" && cspell \"docs/**/*.{ts,md,html}\"", + "cspell": "cspell \"src/**/*.ts\" && cspell \"demo/**/*.{ts,scss,html}\" && cspell \"docs/**/*.{ts,md}\" && cspell \"scripts/**/*.ts\" && cspell \"./*.*\"", "fix-types": "ts-node --skip-project scripts/types-absolute-fixer.ts", "e2e": "ts-node scripts/e2e.ts", "serve.docs": "cd docs && docsify serve", diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 039a04df05..c193236008 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -41,6 +41,7 @@ export interface IPropertiesOptions { // +/* cSpell:disable */ // // // @@ -60,6 +61,7 @@ export interface IPropertiesOptions { // // // +/* cSpell:enable */ export class CoreProperties extends XmlComponent { constructor(options: Omit) {