Add counter to footnotes
This commit is contained in:
@ -3,7 +3,6 @@ import { Formatter } from "../../../export/formatter";
|
|||||||
import { Footnote, FootnoteType } from "./footnote";
|
import { Footnote, FootnoteType } from "./footnote";
|
||||||
|
|
||||||
describe("Footnote", () => {
|
describe("Footnote", () => {
|
||||||
|
|
||||||
describe("#constructor", () => {
|
describe("#constructor", () => {
|
||||||
it("should create a footnote with a footnote type", () => {
|
it("should create a footnote with a footnote type", () => {
|
||||||
const footnote = new Footnote(1, FootnoteType.SEPERATOR);
|
const footnote = new Footnote(1, FootnoteType.SEPERATOR);
|
||||||
|
@ -6,8 +6,13 @@ import { SeperatorRun } from "./footnote/run/seperator-run";
|
|||||||
import { FootnotesAttributes } from "./footnotes-attributes";
|
import { FootnotesAttributes } from "./footnotes-attributes";
|
||||||
|
|
||||||
export class FootNotes extends XmlComponent {
|
export class FootNotes extends XmlComponent {
|
||||||
|
private counter: number;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super("w:footnotes");
|
super("w:footnotes");
|
||||||
|
|
||||||
|
this.counter = 1;
|
||||||
|
|
||||||
this.root.push(
|
this.root.push(
|
||||||
new FootnotesAttributes({
|
new FootnotesAttributes({
|
||||||
wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
|
wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
|
||||||
@ -32,28 +37,34 @@ export class FootNotes extends XmlComponent {
|
|||||||
|
|
||||||
const begin = new Footnote(-1, FootnoteType.SEPERATOR);
|
const begin = new Footnote(-1, FootnoteType.SEPERATOR);
|
||||||
begin.addParagraph(
|
begin.addParagraph(
|
||||||
new Paragraph().spacing({
|
new Paragraph()
|
||||||
after: 0,
|
.spacing({
|
||||||
line: 240,
|
after: 0,
|
||||||
lineRule: "auto",
|
line: 240,
|
||||||
}).addRun(new SeperatorRun()),
|
lineRule: "auto",
|
||||||
|
})
|
||||||
|
.addRun(new SeperatorRun()),
|
||||||
);
|
);
|
||||||
this.root.push(begin);
|
this.root.push(begin);
|
||||||
|
|
||||||
const spacing = new Footnote(0, FootnoteType.CONTINUATION_SEPERATOR);
|
const spacing = new Footnote(0, FootnoteType.CONTINUATION_SEPERATOR);
|
||||||
spacing.addParagraph(
|
spacing.addParagraph(
|
||||||
new Paragraph().spacing({
|
new Paragraph()
|
||||||
after: 0,
|
.spacing({
|
||||||
line: 240,
|
after: 0,
|
||||||
lineRule: "auto",
|
line: 240,
|
||||||
}).addRun(new ContinuationSeperatorRun()),
|
lineRule: "auto",
|
||||||
|
})
|
||||||
|
.addRun(new ContinuationSeperatorRun()),
|
||||||
);
|
);
|
||||||
this.root.push(spacing);
|
this.root.push(spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createFootNote(paragraph: Paragraph): void {
|
public createFootNote(paragraph: Paragraph): void {
|
||||||
const footnote = new Footnote(1);
|
const footnote = new Footnote(this.counter);
|
||||||
footnote.addParagraph(paragraph);
|
footnote.addParagraph(paragraph);
|
||||||
this.root.push(footnote);
|
this.root.push(footnote);
|
||||||
|
|
||||||
|
this.counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user