Files
docx-js/src/file/footnotes/footnote/footnote.ts

28 lines
752 B
TypeScript
Raw Normal View History

2018-10-26 01:04:07 +01:00
import { Paragraph } from "file/paragraph";
2018-06-11 00:45:21 +01:00
import { XmlComponent } from "file/xml-components";
2018-10-26 01:04:07 +01:00
2018-06-11 00:45:21 +01:00
import { FootnoteAttributes } from "./footnote-attributes";
2018-06-28 03:01:25 +01:00
import { FootnoteRefRun } from "./run/footnote-ref-run";
2018-06-11 00:45:21 +01:00
2018-06-30 23:41:57 +01:00
export enum FootnoteType {
SEPERATOR = "separator",
CONTINUATION_SEPERATOR = "continuationSeparator",
}
export class Footnote extends XmlComponent {
constructor(id: number, type?: FootnoteType) {
2018-06-11 00:45:21 +01:00
super("w:footnote");
this.root.push(
new FootnoteAttributes({
type: type,
id: id,
}),
);
}
public addParagraph(paragraph: Paragraph): void {
2018-06-28 03:01:25 +01:00
paragraph.addRunToFront(new FootnoteRefRun());
2018-06-11 00:45:21 +01:00
this.root.push(paragraph);
}
}