/** * Worksheet page setup (`printOptions` / `pageMargins` / `pageSetup`). * * Citations: * - ECMA-376-1 §18.3.1.62–64 * - transitional sml.xsd `CT_PrintOptions`, `CT_PageMargins`, `CT_PageSetup` * - docs/specs/page-setup.md; docs/ooxml-mapping/page-setup.md * - API-RULES R3.5 (`PaperSize.*`) * - Chart anchor size pattern: public size in points; OOXML margins store inches * - XlsIO PageSetup skill * * Print area / titles remain workbook defined names (`_xlnm.*`). * `headerFooter` stays opaque in the after-sheetData bag. * * **Units:** public margin values are **points** (72 points = 1 inch), same * authoring unit as chart `width`/`height`. SpreadsheetML `pageMargins` * attributes are inches; load/save converts at the wire boundary. */ /** Specifies whether a printed page is taller than wide or wider than tall. */ export declare type PageOrientation = 'default' | 'portrait' | 'landscape'; /** * Specifies the order pages are printed when a sheet spans several pages — * down first or across first. */ export declare type PageOrder = 'downThenOver' | 'overThenDown'; /** * The six page margins in **points** (72 points = 1 inch), matching chart * width/height authoring. Example: `54` = 0.75 inches. */ export interface PageMargins { /** * Left margin in points (72 points = 1 inch). * Example: `50.4` = 0.7 inches. */ left: number; /** * Right margin in points (72 points = 1 inch). * Example: `50.4` = 0.7 inches. */ right: number; /** * Top margin in points (72 points = 1 inch). * Example: `54` = 0.75 inches. */ top: number; /** * Bottom margin in points (72 points = 1 inch). * Example: `54` = 0.75 inches. */ bottom: number; /** * Header margin in points (72 points = 1 inch). * Example: `21.6` = 0.3 inches. */ header: number; /** * Footer margin in points (72 points = 1 inch). * Example: `21.6` = 0.3 inches. */ footer: number; } /** * Provides the left, center, and right header and footer sections for a * page kind (default, first, odd, or even). * * Matches the Excel / XlsIO shape `FirstPage.CenterHeader`, `EvenPage.LeftFooter`, etc. */ export interface PageHeaderFooter { /** The text printed in the top-left corner of the page. */ leftHeader: string; /** The text printed centered at the top of the page. */ centerHeader: string; /** The text printed in the top-right corner of the page. */ rightHeader: string; /** The text printed in the bottom-left corner of the page. */ leftFooter: string; /** The text printed centered at the bottom of the page. */ centerFooter: string; /** The text printed in the bottom-right corner of the page. */ rightFooter: string; } /** * Controls how a worksheet prints, letting you set paper size, orientation, * margins, headers and footers, and scaling options. */ export interface PageSetup { /** * The paper size pages print on, given as one of the `PaperSize` * constants — for example `PaperSize.A4` or `PaperSize.Letter`. */ paperSize: number; /** * The page direction: `'portrait'` (tall) or `'landscape'` (wide). * `'default'` leaves the choice to the printer's default. */ orientation: PageOrientation; /** * The blank space around the printed content, in **points** * (72 points = 1 inch — same unit as chart width/height). * * Nested writes work: `sheet.pageSetup.margins.top = 90`. * You can also assign a full or partial object: * `sheet.pageSetup.margins = { top: 108 }` (1.5 inch top margin). * * Declared as a property for TypeScript 3.3 interface compatibility * (no get/set in interfaces). Reads return full {@link PageMargins}; * writes accept a full or partial object at runtime. */ margins: PageMargins | Partial; /** Whether the printed content is centered left-to-right on the page. */ centerHorizontally: boolean; /** Whether the printed content is centered top-to-bottom on the page. */ centerVertically: boolean; /** Whether the sheet's gridlines are printed. */ printGridlines: boolean; /** Whether the row numbers and column letters are printed. */ printHeadings: boolean; /** * Print scale percent (10–400). Retained for OOXML load/save only. * @private */ scale: number; /** * When {@link isFitToPage} is on, the number of pages wide the sheet is * scaled to — `0` means no width limit. */ fitToWidth: number; /** * When {@link isFitToPage} is on, the number of pages tall the sheet is * scaled to — `0` means no height limit. */ fitToHeight: number; /** * Whether Excel scales the sheet to fit the page counts in * {@link fitToWidth} / {@link fitToHeight}, instead of printing at * 100%. */ isFitToPage: boolean; /** * How multi-page sheets are ordered: across then down * (`'overThenDown'`) or down then across (`'downThenOver'`). */ pageOrder: PageOrder; /** * The number printed on the first page — `undefined` lets Excel start * at `1`. */ firstPageNumber: number | undefined; /** The text printed in the top-left corner of every printed page. */ leftHeader: string; /** The text printed centered at the top of every printed page. */ centerHeader: string; /** The text printed in the top-right corner of every printed page. */ rightHeader: string; /** The text printed in the bottom-left corner of every printed page. */ leftFooter: string; /** The text printed centered at the bottom of every printed page. */ centerFooter: string; /** The text printed in the bottom-right corner of every printed page. */ rightFooter: string; /** * Whether the first page uses its own header and footer, separate from * the rest. Set sections on {@link firstPage} to turn this on * automatically. */ differentFirstPage: boolean; /** * The header and footer for the first page, section by section. Writing * any section turns on {@link differentFirstPage}. */ readonly firstPage: PageHeaderFooter; /** * The first page's full header as a single string, using Excel's * `&L` / `&C` / `&R` section markers. Prefer {@link firstPage} for * simpler left/center/right authoring. */ firstPageHeader: string; /** * The first page's full footer as a single string, using Excel's * `&L` / `&C` / `&R` section markers. Prefer {@link firstPage} for * simpler left/center/right authoring. */ firstPageFooter: string; /** * Whether odd and even pages use different headers and footers. Set * sections on {@link evenPage} to turn this on automatically. */ oddAndEvenPagesHeaderFooter: boolean; /** * The header and footer for odd pages, section by section. When the * raw {@link oddHeader} / {@link oddFooter} strings are empty, mirrors * the default {@link leftHeader} / {@link centerHeader} / … properties. */ readonly oddPage: PageHeaderFooter; /** * The header and footer for even pages, section by section. Writing * any section turns on {@link oddAndEvenPagesHeaderFooter}. */ readonly evenPage: PageHeaderFooter; /** The odd pages' full header as a single `&L`/`&C`/`&R` string. */ oddHeader: string; /** The odd pages' full footer as a single `&L`/`&C`/`&R` string. */ oddFooter: string; /** The even pages' full header as a single `&L`/`&C`/`&R` string. */ evenHeader: string; /** The even pages' full footer as a single `&L`/`&C`/`&R` string. */ evenFooter: string; /** * The part of the sheet that prints, as a range address — `undefined` * prints the whole sheet. */ printArea: string | undefined; /** * The rows repeated at the top of every printed page — for example * `'1:2'` to repeat rows 1 and 2. `undefined` repeats nothing. */ printTitleRows: string | undefined; /** * The columns repeated at the left of every printed page — for example * `'A:B'` to repeat columns A and B. `undefined` repeats nothing. */ printTitleColumns: string | undefined; } /** * Wire model for the print trio. * @private */ export interface PageSetupModel { /** True when any of the three elements was present or authored. */ readonly present: boolean; readonly printOptionsPresent: boolean; readonly pageMarginsPresent: boolean; readonly pageSetupPresent: boolean; readonly paperSize: number; readonly orientation: PageOrientation; readonly margins: PageMargins; readonly centerHorizontally: boolean; readonly centerVertically: boolean; readonly printGridlines: boolean; readonly printHeadings: boolean; readonly scale: number; readonly fitToWidth: number; readonly fitToHeight: number; readonly isFitToPage: boolean; readonly pageOrder: PageOrder; readonly firstPageNumber: number | undefined; readonly leftHeader: string; readonly centerHeader: string; readonly rightHeader: string; readonly leftFooter: string; readonly centerFooter: string; readonly rightFooter: string; readonly differentFirstPage: boolean; readonly firstPageHeader: string; readonly firstPageFooter: string; readonly oddAndEvenPagesHeaderFooter: boolean; readonly oddHeader: string; readonly oddFooter: string; readonly evenHeader: string; readonly evenFooter: string; readonly headerFooterPresent: boolean; readonly headerFooterExtraAttrsXml: string; readonly printOptionsExtraAttrsXml: string; readonly pageMarginsExtraAttrsXml: string; readonly pageSetupExtraAttrsXml: string; /** * When true, fitTo* was explicitly set on wire or by author (affects * whether scale vs fit attributes are emphasized on write). */ readonly fitToPage: boolean; } /** * Host notifications. * @private */ export interface PageSetupHost { markDirty(): void; getPrintName(name: 'Print_Area' | 'Print_Titles'): string | undefined; setPrintName(name: 'Print_Area' | 'Print_Titles', content: string | undefined): void; } /** * CT_Worksheet local names before the print trio (after sheetData). * Used so each element inserts immediately after hyperlinks / prior siblings. */ export declare const PRINT_OPTIONS_PREDECESSORS: ReadonlyArray; export declare const PAGE_MARGINS_PREDECESSORS: ReadonlyArray; export declare const PAGE_SETUP_PREDECESSORS: ReadonlyArray; export declare const PAGE_SETUP_SUCCESSORS: ReadonlyArray; /** @private */ export declare function findPrintOptionsInsertIndex(locals: ReadonlyArray): number; /** @private */ export declare function findPageMarginsInsertIndex(locals: ReadonlyArray): number; /** @private */ export declare function findPageSetupInsertIndex(locals: ReadonlyArray): number; /** * Mutable page-setup store. * @private */ export declare class PageSetupImpl implements PageSetup { private model; private host; constructor(initial?: PageSetupModel); /** @private */ bindHost(host: PageSetupHost): void; /** @private */ replaceFromParse(model: PageSetupModel): void; /** @private */ toModel(): PageSetupModel; paperSize: number; orientation: PageOrientation; margins: PageMargins | Partial; /** Live view so `pageSetup.margins.top = n` writes through to the model. */ private marginsView; centerHorizontally: boolean; centerVertically: boolean; printGridlines: boolean; printHeadings: boolean; /** * Print scale percent (10–400). Retained for OOXML load/save only. * @private */ /** * Print scale percent (10–400). Retained for OOXML load/save only. * @private */ scale: number; fitToWidth: number; fitToHeight: number; isFitToPage: boolean; firstPageNumber: number | undefined; leftHeader: string; centerHeader: string; rightHeader: string; leftFooter: string; centerFooter: string; rightFooter: string; differentFirstPage: boolean; /** * First-page L/C/R header and footer sections (Excel / XlsIO `FirstPage.*`). */ readonly firstPage: PageHeaderFooter; firstPageHeader: string; firstPageFooter: string; oddAndEvenPagesHeaderFooter: boolean; /** * Odd-page L/C/R sections. Falls back to default left/center/right when raw odd strings are empty. */ readonly oddPage: PageHeaderFooter; /** * Even-page L/C/R header and footer sections (Excel / XlsIO `EvenPage.*`). */ readonly evenPage: PageHeaderFooter; oddHeader: string; oddFooter: string; evenHeader: string; evenFooter: string; private pageHeaderFooterView; printArea: string | undefined; printTitleRows: string | undefined; printTitleColumns: string | undefined; private setPrintTitles; pageOrder: PageOrder; private setHeaderFooter; private ensurePresent; private touch; } /** * Merge parse results for the three optional elements into one model. * @private */ export declare function mergePageSetupParse(parts: { printOptionsXml?: string; pageMarginsXml?: string; pageSetupXml?: string; headerFooterXml?: string; }): PageSetupModel; /** * Serialize print trio to ordered element strings (omit empty). * @private */ export declare function serializePageSetupElements(model: PageSetupModel): { printOptionsXml: string | undefined; pageMarginsXml: string | undefined; headerFooterXml: string | undefined; pageSetupXml: string | undefined; };