diff --git a/src/file/paragraph/run/formatting.ts b/src/file/paragraph/run/formatting.ts index bd9da1c358..a59879917c 100644 --- a/src/file/paragraph/run/formatting.ts +++ b/src/file/paragraph/run/formatting.ts @@ -14,6 +14,17 @@ export class Bold extends XmlComponent { } } +export class BoldCs extends XmlComponent { + constructor() { + super("w:bCs"); + this.root.push( + new Attributes({ + val: true, + }), + ); + } +} + export class Italics extends XmlComponent { constructor() { super("w:i"); @@ -25,6 +36,17 @@ export class Italics extends XmlComponent { } } +export class ItalicsCs extends XmlComponent { + constructor() { + super("w:iCs"); + this.root.push( + new Attributes({ + val: true, + }), + ); + } +} + export class Caps extends XmlComponent { constructor() { super("w:caps"); diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index 5fbe93ee92..52443bc0d2 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -16,6 +16,7 @@ describe("Run", () => { run.bold(); const newJson = Utility.jsonify(run); assert.equal(newJson.root[0].root[0].rootKey, "w:b"); + assert.equal(newJson.root[0].root[1].rootKey, "w:bCs"); }); }); @@ -24,6 +25,7 @@ describe("Run", () => { run.italic(); const newJson = Utility.jsonify(run); assert.equal(newJson.root[0].root[0].rootKey, "w:i"); + assert.equal(newJson.root[0].root[1].rootKey, "w:iCs"); }); }); diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index ea45bbcd34..b08627aadb 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -1,7 +1,7 @@ // http://officeopenxml.com/WPtext.php import { Break } from "./break"; import { Caps, SmallCaps } from "./caps"; -import { Bold, Color, DoubleStrike, Italics, RTL, Size, SizeCs, Strike } from "./formatting"; +import { Bold, BoldCs, Color, DoubleStrike, Italics, ItalicsCs, RTL, Size, SizeCs, Strike } from "./formatting"; import { Begin, End, Page, Separate } from "./page-number"; import { RunProperties } from "./properties"; import { RunFonts } from "./run-fonts"; @@ -23,11 +23,13 @@ export class Run extends XmlComponent { public bold(): Run { this.properties.push(new Bold()); + this.properties.push(new BoldCs()); return this; } public italic(): Run { this.properties.push(new Italics()); + this.properties.push(new ItalicsCs()); return this; }