This commit is contained in:
amitm02
2018-07-25 15:02:58 +03:00
parent 0689489985
commit 696b5daf5c
211 changed files with 252 additions and 84025 deletions

View File

@ -124,6 +124,17 @@ export class Size extends XmlComponent {
}
}
export class SizeCs extends XmlComponent {
constructor(size: number) {
super("w:szCs");
this.root.push(
new Attributes({
val: size,
}),
);
}
}
export class RTL extends XmlComponent {
constructor() {
super("w:rtl");
@ -133,4 +144,4 @@ export class RTL extends XmlComponent {
}),
);
}
}
}

View File

@ -134,7 +134,11 @@ describe("Run", () => {
run.size(24);
const tree = new Formatter().format(run);
expect(tree).to.deep.equal({
"w:r": [{ "w:rPr": [{ "w:sz": [{ _attr: { "w:val": 24 } }] }] }],
"w:r": [
{
"w:rPr": [{ "w:sz": [{ _attr: { "w:val": 24 } }] }, { "w:szCs": [{ _attr: { "w:val": 24 } }] }],
},
],
});
});
});
@ -144,7 +148,7 @@ describe("Run", () => {
run.rtl();
const tree = new Formatter().format(run);
expect(tree).to.deep.equal({
"w:r": [{ "w:rPr": [{ "w:rtl": [{ _attr: { "w:val": true } }]}]}],
"w:r": [{ "w:rPr": [{ "w:rtl": [{ _attr: { "w:val": true } }] }] }],
});
});
});

View File

@ -1,7 +1,7 @@
// http://officeopenxml.com/WPtext.php
import { Break } from "./break";
import { Caps, SmallCaps } from "./caps";
import { Bold, Color, DoubleStrike, Italics, Size, RTL, Strike } from "./formatting";
import { Bold, Color, DoubleStrike, Italics, RTL, Size, SizeCs, Strike } from "./formatting";
import { Begin, End, Page, Separate } from "./page-number";
import { RunProperties } from "./properties";
import { RunFonts } from "./run-fonts";
@ -43,6 +43,7 @@ export class Run extends XmlComponent {
public size(size: number): Run {
this.properties.push(new Size(size));
this.properties.push(new SizeCs(size));
return this;
}
@ -99,8 +100,8 @@ export class Run extends XmlComponent {
return this;
}
public font(fontName: string): Run {
this.properties.push(new RunFonts(fontName));
public font(fontName: string, hint?: string | undefined): Run {
this.properties.push(new RunFonts(fontName, hint));
return this;
}