feature: add support to add mutiple sections to the document inc. headers and footers
- write missing tests
This commit is contained in:
@ -1,5 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export enum FooterReferenceType {
|
||||
DEFAULT = "default",
|
||||
FIRST = "first",
|
||||
EVEN = "even",
|
||||
}
|
||||
|
||||
export interface IFooterReferenceAttributes {
|
||||
type: string;
|
||||
id: string;
|
||||
|
@ -1,13 +1,19 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { FooterReferenceAttributes } from "./footer-reference-attributes";
|
||||
import { FooterReferenceAttributes, FooterReferenceType } from "./footer-reference-attributes";
|
||||
|
||||
export interface FooterOptions {
|
||||
footerType?: FooterReferenceType;
|
||||
footerId?: number;
|
||||
}
|
||||
|
||||
export class FooterReference extends XmlComponent {
|
||||
constructor() {
|
||||
constructor(options: FooterOptions) {
|
||||
super("w:footerReference");
|
||||
|
||||
this.root.push(
|
||||
new FooterReferenceAttributes({
|
||||
type: "default",
|
||||
id: `rId${4}`,
|
||||
type: options.footerType || FooterReferenceType.DEFAULT,
|
||||
id: `rId${options.footerId}`,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
export * from "./footer-reference";
|
||||
export * from "./footer-reference-attributes";
|
Reference in New Issue
Block a user