Multiple paragraphs in footnotes

This commit is contained in:
Dolan
2020-01-01 20:22:42 +00:00
parent 97824f1bb5
commit 9c11653313
9 changed files with 86 additions and 61 deletions

View File

@ -10,18 +10,23 @@ export enum FootnoteType {
}
export class Footnote extends XmlComponent {
constructor(id: number, type?: FootnoteType) {
constructor(options: { readonly id: number; readonly type?: FootnoteType; readonly children: Paragraph[] }) {
super("w:footnote");
this.root.push(
new FootnoteAttributes({
type: type,
id: id,
type: options.type,
id: options.id,
}),
);
}
public add(paragraph: Paragraph): void {
paragraph.addRunToFront(new FootnoteRefRun());
this.root.push(paragraph);
for (let i = 0; i < options.children.length; i++) {
const child = options.children[i];
if (i === 0) {
child.addRunToFront(new FootnoteRefRun());
}
this.root.push(child);
}
}
}