Add the pageref element

This instruction is useful if you want to get the number of the page
containing a specific bookmark.
This commit is contained in:
Thomas Gerbet
2021-08-03 15:58:26 +02:00
parent 14013273af
commit 3f257bf5a4
8 changed files with 173 additions and 1 deletions

View File

@ -0,0 +1,13 @@
// See https://www.ecma-international.org/publications/standards/Ecma-376.htm (at Part 1, Page 1234)
import { Begin, End } from "file/paragraph/run/field";
import { Run } from "../run";
import { PageRefFieldInstruction } from "./pageref-field-instruction";
import type { IPageRefOptions } from "./pageref-properties";
export class PageRef extends Run {
constructor(bookmarkId: string, options: IPageRefOptions = {}) {
super({
children: [new Begin(true), new PageRefFieldInstruction(bookmarkId, options), new End()],
});
}
}