added heading styles
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import {XmlComponent, Attributes} from "../../docx/xml-components";
|
import {XmlComponent, Attributes} from "../xml-components";
|
||||||
|
|
||||||
export class Bold extends XmlComponent {
|
export class Bold extends XmlComponent {
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ export class Size extends XmlComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// needs work
|
// needs work. Add more types of vertical align
|
||||||
export class VerticalAlign extends XmlComponent {
|
export class VerticalAlign extends XmlComponent {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
@ -1,6 +1,6 @@
|
|||||||
import {XmlComponent, Attributes} from "../xml-components";
|
import {XmlComponent, Attributes} from "../xml-components";
|
||||||
import {RunProperties} from "./properties";
|
import {RunProperties} from "./properties";
|
||||||
import {Bold, Italics, Underline} from "../../styles/formatting/run";
|
import {Bold, Italics, Underline} from "./formatting";
|
||||||
|
|
||||||
export class Run extends XmlComponent {
|
export class Run extends XmlComponent {
|
||||||
private properties: RunProperties;
|
private properties: RunProperties;
|
||||||
|
@ -4,9 +4,9 @@ import {RunPropertiesDefaults} from "./run-properties";
|
|||||||
|
|
||||||
export class DocumentDefaults extends XmlComponent {
|
export class DocumentDefaults extends XmlComponent {
|
||||||
|
|
||||||
constructor() {
|
constructor(runPropertiesDefaults: RunPropertiesDefaults, paragraphPropertiesDefaults: ParagraphPropertiesDefaults) {
|
||||||
super("w:docDefaults");
|
super("w:docDefaults");
|
||||||
this.root.push(new RunPropertiesDefaults());
|
this.root.push(runPropertiesDefaults);
|
||||||
this.root.push(new ParagraphPropertiesDefaults());
|
this.root.push(paragraphPropertiesDefaults);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,8 +56,11 @@ export class UnhideWhenUsed extends XmlComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QFormat extends XmlComponent {
|
export class QuickFormat extends XmlComponent {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super("w:qFormat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TableProperties extends XmlComponent {
|
export class TableProperties extends XmlComponent {
|
||||||
|
@ -1,18 +1,83 @@
|
|||||||
import {XmlComponent} from "../../docx/xml-components";
|
import {XmlComponent} from "../../docx/xml-components";
|
||||||
import {StyleAttributes} from "./attributes";
|
import {StyleAttributes} from "./attributes";
|
||||||
|
import {ParagraphProperties} from "../../docx/paragraph/properties";
|
||||||
|
import {RunProperties} from "../../docx/run/properties";
|
||||||
|
import {Name, BasedOn, Next, QuickFormat} from "./components";
|
||||||
|
|
||||||
export class Style extends XmlComponent {
|
export class Style extends XmlComponent {
|
||||||
|
|
||||||
constructor(attributes: StyleAttributes) {
|
constructor(attributes: StyleAttributes) {
|
||||||
super("w:style");
|
super("w:style");
|
||||||
this.root.push(attributes);
|
this.root.push(attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
push(styleSegment: XmlComponent): void {
|
push(styleSegment: XmlComponent): void {
|
||||||
this.root.push(styleSegment);
|
this.root.push(styleSegment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ParagraphStyle extends XmlComponent {
|
export class ParagraphStyle extends Style {
|
||||||
|
|
||||||
|
constructor(styleId: string, paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
var attributes = new StyleAttributes({
|
||||||
|
type: "paragraph",
|
||||||
|
styleId: styleId
|
||||||
|
});
|
||||||
|
super(attributes);
|
||||||
|
this.root.push(paragraphProperties);
|
||||||
|
this.root.push(runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class HeadingStyle extends ParagraphStyle {
|
||||||
|
|
||||||
|
constructor(styleId: string, name: string, paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super(styleId, paragraphProperties, runProperties);
|
||||||
|
this.root.push(new Name(name));
|
||||||
|
this.root.push(new BasedOn("Normal"));
|
||||||
|
this.root.push(new Next("Normal"));
|
||||||
|
this.root.push(new QuickFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading1Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading1", "Heading 1", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading2Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading2", "Heading 2", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading3Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading3", "Heading 3", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading4Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading4", "Heading 4", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading5Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading5", "Heading 5", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Heading6Style extends HeadingStyle {
|
||||||
|
|
||||||
|
constructor(paragraphProperties: ParagraphProperties, runProperties: RunProperties) {
|
||||||
|
super("Heading6", "Heading 6", paragraphProperties, runProperties);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user