Correctly exporting methods
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
// Page numbers
|
// Page numbers
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { AlignmentType, Document, Header, Packer, PageBreak, Paragraph, TextRun } from "../build";
|
import { AlignmentType, Document, Header, Packer, PageBreak, PageNumber, Paragraph, TextRun } from "../build";
|
||||||
import { PageNumber } from "../build/file/paragraph";
|
|
||||||
|
|
||||||
const doc = new Document();
|
const doc = new Document();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Footnotes
|
// Footnotes
|
||||||
// Import from 'docx' rather than '../build' if you install from npm
|
// Import from 'docx' rather than '../build' if you install from npm
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { Document, Packer, Paragraph, TextRun, FootnoteReferenceRun } from "../build";
|
import { Document, FootnoteReferenceRun, Packer, Paragraph, TextRun } from "../build";
|
||||||
|
|
||||||
const doc = new Document();
|
const doc = new Document();
|
||||||
|
|
||||||
@ -17,7 +17,9 @@ doc.addSection({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
new Paragraph("Hello World").referenceFootnote(3),
|
new Paragraph({
|
||||||
|
children: [new TextRun("Hello World"), new FootnoteReferenceRun(3)],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ const header = new Header({
|
|||||||
new TextRun({
|
new TextRun({
|
||||||
children: ["Page number: ", PageNumber.CURRENT],
|
children: ["Page number: ", PageNumber.CURRENT],
|
||||||
}),
|
}),
|
||||||
new TextRun(" to ").numberOfTotalPagesSection(),
|
new TextRun({
|
||||||
|
children: [" to ", PageNumber.TOTAL_PAGES_IN_SECTION],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
alignment: AlignmentType.CENTER,
|
alignment: AlignmentType.CENTER,
|
||||||
}),
|
}),
|
||||||
|
1
src/file/footnotes/footnote/index.ts
Normal file
1
src/file/footnotes/footnote/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./run";
|
1
src/file/footnotes/footnote/run/index.ts
Normal file
1
src/file/footnotes/footnote/run/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./reference-run";
|
@ -1 +1,2 @@
|
|||||||
export * from "./footnotes";
|
export * from "./footnotes";
|
||||||
|
export * from "./footnote";
|
||||||
|
@ -12,3 +12,4 @@ export * from "./xml-components";
|
|||||||
export * from "./header-wrapper";
|
export * from "./header-wrapper";
|
||||||
export * from "./footer-wrapper";
|
export * from "./footer-wrapper";
|
||||||
export * from "./header";
|
export * from "./header";
|
||||||
|
export * from "./footnotes";
|
||||||
|
@ -44,7 +44,9 @@ export interface IParagraphOptions {
|
|||||||
readonly level: number;
|
readonly level: number;
|
||||||
readonly custom?: boolean;
|
readonly custom?: boolean;
|
||||||
};
|
};
|
||||||
readonly children?: Array<TextRun | PictureRun | Hyperlink | SymbolRun | Bookmark | PageBreak | SequentialIdentifier>;
|
readonly children?: Array<
|
||||||
|
TextRun | PictureRun | Hyperlink | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun
|
||||||
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Paragraph extends XmlComponent {
|
export class Paragraph extends XmlComponent {
|
||||||
@ -157,11 +159,6 @@ export class Paragraph extends XmlComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public referenceFootnote(id: number): Paragraph {
|
|
||||||
this.root.push(new FootnoteReferenceRun(id));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addRunToFront(run: Run): Paragraph {
|
public addRunToFront(run: Run): Paragraph {
|
||||||
this.root.splice(1, 0, run);
|
this.root.splice(1, 0, run);
|
||||||
return this;
|
return this;
|
||||||
|
Reference in New Issue
Block a user