Files
docx-js/src/file/header-wrapper.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-06-09 23:49:01 +01:00
import { XmlComponent } from "file/xml-components";
2018-10-23 00:31:51 +01:00
2018-09-17 20:06:51 +01:00
import { HeaderReferenceType } from "./document";
import { Header } from "./header/header";
2019-09-29 04:17:21 +01:00
import { Media } from "./media";
2019-06-25 01:21:28 +01:00
import { Paragraph } from "./paragraph";
import { Relationships } from "./relationships";
import { Table } from "./table";
2018-08-29 18:36:48 +03:00
2018-09-17 20:06:51 +01:00
export interface IDocumentHeader {
readonly header: HeaderWrapper;
readonly type: HeaderReferenceType;
2018-09-17 20:06:51 +01:00
}
2018-12-24 16:50:53 +00:00
export class HeaderWrapper {
private readonly header: Header;
private readonly relationships: Relationships;
2018-10-23 00:31:51 +01:00
constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
2018-08-29 18:36:48 +03:00
this.header = new Header(referenceId, initContent);
this.relationships = new Relationships();
}
public add(item: Paragraph | Table): HeaderWrapper {
this.header.add(item);
return this;
}
2018-06-09 23:49:01 +01:00
public addChildElement(childElement: XmlComponent | string): void {
this.header.addChildElement(childElement);
}
public get Header(): Header {
return this.header;
}
public get Relationships(): Relationships {
return this.relationships;
}
2018-09-07 21:48:59 +01:00
public get Media(): Media {
return this.media;
}
}