diff --git a/.gitignore b/.gitignore index 287fdb8f83..2ec3d77b21 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ My Document.docx # Temporary folder tmp + +# Exclude Mac .DS_Store files +.DS_Store diff --git a/src/file/paragraph/run/properties.ts b/src/file/paragraph/run/properties.ts index 41ca650995..93ab96cfa4 100644 --- a/src/file/paragraph/run/properties.ts +++ b/src/file/paragraph/run/properties.ts @@ -1,3 +1,4 @@ +// https://www.ecma-international.org/wp-content/uploads/ECMA-376-1_5th_edition_december_2016.zip page 297, section 17.3.2.21 import { BorderElement, IBorderOptions } from "@file/border"; import { IShadingAttributesProperties, Shading } from "@file/shading"; import { ChangeAttributes, IChangedAttributesProperties } from "@file/track-revision/track-revision"; @@ -34,6 +35,7 @@ export enum TextEffect { } export interface IRunStylePropertiesOptions { + readonly noProof?: boolean; readonly bold?: boolean; readonly boldComplexScript?: boolean; readonly italics?: boolean; @@ -131,7 +133,9 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent { if (!options) { return; } - + if (options.noProof !== undefined) { + this.push(new OnOffElement("w:noProof", options.noProof)); + } if (options.bold !== undefined) { this.push(new OnOffElement("w:b", options.bold)); } diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index b2027c2cfb..162804b5ba 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -8,8 +8,23 @@ import { EmphasisMarkType } from "./emphasis-mark"; import { PageNumber, Run } from "./run"; import { UnderlineType } from "./underline"; import { TextEffect } from "./properties"; - describe("Run", () => { + describe("#noProof()", () => { + it("turns off spelling and grammar checkers for a run", () => { + const run = new Run({ + noProof: true, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [ + { + "w:rPr": [{ "w:noProof": {} }], + }, + ], + }); + }); + }); + describe("#bold()", () => { it("it should add bold to the properties", () => { const run = new Run({