added heading styles

This commit is contained in:
Dolan Miu
2016-05-08 17:01:20 +01:00
parent c6291f57ab
commit a1b4facb40
5 changed files with 79 additions and 11 deletions

133
ts/docx/run/formatting.ts Normal file
View File

@ -0,0 +1,133 @@
import {XmlComponent, Attributes} from "../xml-components";
export class Bold extends XmlComponent {
constructor() {
super("w:b");
this.root.push(new Attributes({
val: true
}));
}
}
export class Italics extends XmlComponent {
constructor() {
super("w:i");
this.root.push(new Attributes({
val: true
}));
}
}
// needs work. add more types of underline
export class Underline extends XmlComponent {
constructor() {
super("w:u");
this.root.push(new Attributes({
val: true
}));
}
}
export class Caps extends XmlComponent {
constructor() {
super("w:caps");
this.root.push(new Attributes({
val: true
}));
}
}
export class Color extends XmlComponent {
constructor(color: string) {
super("w:color");
this.root.push(new Attributes({
val: color
}));
}
}
export class DoubleStrike extends XmlComponent {
constructor() {
super("w:dstrike");
this.root.push(new Attributes({
val: true
}));
}
}
export class Emboss extends XmlComponent {
constructor() {
super("w:emboss");
this.root.push(new Attributes({
val: true
}));
}
}
export class Imprint extends XmlComponent {
constructor() {
super("w:imprint");
this.root.push(new Attributes({
val: true
}));
}
}
export class Shadow extends XmlComponent {
constructor() {
super("w:shadow");
this.root.push(new Attributes({
val: true
}));
}
}
export class SmallCaps extends XmlComponent {
constructor() {
super("w:smallCaps");
this.root.push(new Attributes({
val: true
}));
}
}
export class Strike extends XmlComponent {
constructor() {
super("w:strike");
this.root.push(new Attributes({
val: true
}));
}
}
export class Size extends XmlComponent {
constructor(size: number) {
super("w:sz");
this.root.push(new Attributes({
val: size
}));
}
}
// needs work. Add more types of vertical align
export class VerticalAlign extends XmlComponent {
constructor() {
super("w:vertAlign");
this.root.push(new Attributes({
val: "superscript"
}));
}
}

View File

@ -1,6 +1,6 @@
import {XmlComponent, Attributes} from "../xml-components";
import {RunProperties} from "./properties";
import {Bold, Italics, Underline} from "../../styles/formatting/run";
import {Bold, Italics, Underline} from "./formatting";
export class Run extends XmlComponent {
private properties: RunProperties;