added new run methods
This commit is contained in:
15
ts/docx/run/caps.ts
Normal file
15
ts/docx/run/caps.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {XmlComponent} from "../xml-components";
|
||||
|
||||
export class SmallCaps extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
super("w:smallCaps");
|
||||
}
|
||||
}
|
||||
|
||||
export class Caps extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
super("w:caps");
|
||||
}
|
||||
}
|
@ -120,14 +120,3 @@ export class Size extends XmlComponent {
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO needs work. Add more types of vertical align
|
||||
export class VerticalAlign extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
super("w:vertAlign");
|
||||
this.root.push(new Attributes({
|
||||
val: "superscript"
|
||||
}));
|
||||
}
|
||||
}
|
@ -3,6 +3,9 @@ import {RunProperties} from "./properties";
|
||||
import {Bold, Italics, Underline} from "./formatting";
|
||||
import {Tab} from "./tab";
|
||||
import {Break} from "./break";
|
||||
import {SmallCaps, Caps} from "./caps";
|
||||
import {Strike, DoubleStrike} from "./strike";
|
||||
import {SubScript, SuperScript} from "./script";
|
||||
|
||||
export class Run extends XmlComponent {
|
||||
private properties: RunProperties;
|
||||
@ -38,4 +41,34 @@ export class Run extends XmlComponent {
|
||||
this.root.splice(1, 0, new Tab());
|
||||
return this;
|
||||
}
|
||||
|
||||
smallCaps(): Run {
|
||||
this.properties.push(new SmallCaps());
|
||||
return this;
|
||||
}
|
||||
|
||||
allCaps(): Run {
|
||||
this.properties.push(new Caps());
|
||||
return this;
|
||||
}
|
||||
|
||||
strike(): Run {
|
||||
this.properties.push(new Strike());
|
||||
return this;
|
||||
}
|
||||
|
||||
doubleStrike(): Run {
|
||||
this.properties.push(new DoubleStrike());
|
||||
return this;
|
||||
}
|
||||
|
||||
subScript(): Run {
|
||||
this.properties.push(new SubScript());
|
||||
return this;
|
||||
}
|
||||
|
||||
superScript(): Run {
|
||||
this.properties.push(new SuperScript());
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {XmlComponent, Attributes} from "../xml-components";
|
||||
import {XmlComponent} from "../xml-components";
|
||||
|
||||
export class RunProperties extends XmlComponent {
|
||||
|
||||
|
25
ts/docx/run/script.ts
Normal file
25
ts/docx/run/script.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {XmlComponent, Attributes} from "../xml-components";
|
||||
|
||||
abstract class VerticalAlign extends XmlComponent {
|
||||
|
||||
constructor(type: string) {
|
||||
super("w:vertAlign");
|
||||
this.root.push(new Attributes({
|
||||
val: "superscript"
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export class SuperScript extends VerticalAlign {
|
||||
|
||||
constructor() {
|
||||
super("superscript");
|
||||
}
|
||||
}
|
||||
|
||||
export class SubScript extends VerticalAlign {
|
||||
|
||||
constructor() {
|
||||
super("subscript");
|
||||
}
|
||||
}
|
15
ts/docx/run/strike.ts
Normal file
15
ts/docx/run/strike.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {XmlComponent} from "../xml-components";
|
||||
|
||||
export class Strike extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
super("w:strike");
|
||||
}
|
||||
}
|
||||
|
||||
export class DoubleStrike extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
super("w:dstrike");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user