add rtl mode
This commit is contained in:
@ -123,3 +123,14 @@ export class Size extends XmlComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RTL extends XmlComponent {
|
||||||
|
constructor() {
|
||||||
|
super("w:rtl");
|
||||||
|
this.root.push(
|
||||||
|
new Attributes({
|
||||||
|
val: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -139,6 +139,16 @@ describe("Run", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("#rtl", () => {
|
||||||
|
it("should set the run to the RTL mode", () => {
|
||||||
|
run.rtl();
|
||||||
|
const tree = new Formatter().format(run);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:r": [{ "w:rPr": [{ "w:rtl": [{ _attr: { "w:val": true } }]}]}],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("#style", () => {
|
describe("#style", () => {
|
||||||
it("should set the style to the given styleId", () => {
|
it("should set the style to the given styleId", () => {
|
||||||
run.style("myRunStyle");
|
run.style("myRunStyle");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// http://officeopenxml.com/WPtext.php
|
// http://officeopenxml.com/WPtext.php
|
||||||
import { Break } from "./break";
|
import { Break } from "./break";
|
||||||
import { Caps, SmallCaps } from "./caps";
|
import { Caps, SmallCaps } from "./caps";
|
||||||
import { Bold, Color, DoubleStrike, Italics, Size, Strike } from "./formatting";
|
import { Bold, Color, DoubleStrike, Italics, Size, RTL, Strike } from "./formatting";
|
||||||
import { Begin, End, Page, Separate } from "./page-number";
|
import { Begin, End, Page, Separate } from "./page-number";
|
||||||
import { RunProperties } from "./properties";
|
import { RunProperties } from "./properties";
|
||||||
import { RunFonts } from "./run-fonts";
|
import { RunFonts } from "./run-fonts";
|
||||||
@ -46,6 +46,11 @@ export class Run extends XmlComponent {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public rtl(): Run {
|
||||||
|
this.properties.push(new RTL());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public break(): Run {
|
public break(): Run {
|
||||||
this.root.splice(1, 0, new Break());
|
this.root.splice(1, 0, new Break());
|
||||||
return this;
|
return this;
|
||||||
|
Reference in New Issue
Block a user