diff --git a/src/file/file.ts b/src/file/file.ts index 13015a812f..30e9547bce 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -3,6 +3,7 @@ import { ContentTypes } from "./content-types/content-types"; import { CoreProperties, IPropertiesOptions } from "./core-properties"; import { Document } from "./document"; import { + FooterReference, FooterReferenceType, HeaderReference, HeaderReferenceType, @@ -218,6 +219,32 @@ export class File { return headerWrapper; } + public createFirstPageFooter(): FooterWrapper { + const footerWrapper = this.createFooter(); + + this.document.Body.DefaultSection.addChildElement( + new FooterReference({ + footerType: FooterReferenceType.FIRST, + footerId: footerWrapper.Footer.ReferenceId, + }), + ); + + return footerWrapper; + } + + public createEvenPageFooter(): FooterWrapper { + const footerWrapper = this.createFooter(); + + this.document.Body.DefaultSection.addChildElement( + new FooterReference({ + footerType: FooterReferenceType.EVEN, + footerId: footerWrapper.Footer.ReferenceId, + }), + ); + + return footerWrapper; + } + public getFooterByReferenceNumber(refId: number): FooterWrapper { const entry = this.footers.map((item) => item.footer).find((h) => h.Footer.ReferenceId === refId); if (entry) {