2017-03-08 20:52:37 +01:00
|
|
|
import { Break } from "./break";
|
|
|
|
import { Caps, SmallCaps } from "./caps";
|
|
|
|
import { Bold, Italics } from "./formatting";
|
|
|
|
import { RunProperties } from "./properties";
|
2017-03-08 20:29:12 +01:00
|
|
|
import { RunFonts } from "./run-fonts";
|
2017-03-08 20:52:37 +01:00
|
|
|
import { SubScript, SuperScript } from "./script";
|
|
|
|
import { DoubleStrike, Strike } from "./strike";
|
|
|
|
import { Tab } from "./tab";
|
|
|
|
import { Underline } from "./underline";
|
|
|
|
|
|
|
|
import { Attributes, XmlComponent } from "../xml-components";
|
2016-03-30 03:50:53 +01:00
|
|
|
|
2016-04-09 20:16:35 +01:00
|
|
|
export class Run extends XmlComponent {
|
2016-03-30 03:50:53 +01:00
|
|
|
private properties: RunProperties;
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2016-03-30 03:50:53 +01:00
|
|
|
constructor() {
|
2016-04-09 20:16:35 +01:00
|
|
|
super("w:r");
|
2016-03-30 03:50:53 +01:00
|
|
|
this.properties = new RunProperties();
|
2016-04-09 20:16:35 +01:00
|
|
|
this.root.push(this.properties);
|
2016-03-30 03:50:53 +01:00
|
|
|
}
|
2016-03-30 04:43:56 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public bold(): Run {
|
2016-03-30 04:30:58 +01:00
|
|
|
this.properties.push(new Bold());
|
|
|
|
return this;
|
|
|
|
}
|
2016-03-30 04:43:56 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public italic(): Run {
|
2016-03-30 04:43:56 +01:00
|
|
|
this.properties.push(new Italics());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public underline(): Run {
|
2016-03-30 04:43:56 +01:00
|
|
|
this.properties.push(new Underline());
|
|
|
|
return this;
|
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public break(): Run {
|
2016-07-07 18:57:44 +01:00
|
|
|
this.root.splice(1, 0, new Break());
|
2016-05-18 17:06:50 +01:00
|
|
|
return this;
|
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public tab(): Run {
|
2016-06-10 15:03:44 +01:00
|
|
|
this.root.splice(1, 0, new Tab());
|
2016-05-17 23:37:36 +01:00
|
|
|
return this;
|
|
|
|
}
|
2016-07-12 08:25:53 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public smallCaps(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new SmallCaps());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public allCaps(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new Caps());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public strike(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new Strike());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public doubleStrike(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new DoubleStrike());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public subScript(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new SubScript());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public superScript(): Run {
|
2016-07-12 08:25:53 +01:00
|
|
|
this.properties.push(new SuperScript());
|
|
|
|
return this;
|
|
|
|
}
|
2017-03-08 20:29:12 +01:00
|
|
|
|
2017-03-08 20:52:37 +01:00
|
|
|
public font(fontName: string): Run {
|
2017-03-08 20:29:12 +01:00
|
|
|
this.properties.push(new RunFonts(fontName));
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|