// http://officeopenxml.com/WPSectionPgNumType.php import { NumberFormat } from "@file/shared/number-format"; import { XmlAttributeComponent, XmlComponent } from "@file/xml-components"; import { decimalNumber } from "@util/values"; // // // // // // // // // export const PageNumberSeparator = { HYPHEN: "hyphen", PERIOD: "period", COLON: "colon", EM_DASH: "emDash", EN_DASH: "endash", } as const; export type IPageNumberTypeAttributes = { readonly start?: number; readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat]; readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator]; }; // // // // // // export class PageNumberTypeAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { start: "w:start", formatType: "w:fmt", separator: "w:chapSep", }; } export class PageNumberType extends XmlComponent { public constructor({ start, formatType, separator }: IPageNumberTypeAttributes) { super("w:pgNumType"); this.root.push( new PageNumberTypeAttributes({ start: start === undefined ? undefined : decimalNumber(start), formatType, separator, }), ); } }