import { type Cell } from '../cell/cell'; import type { Relationships } from '../packaging/relationships'; import type { SharedStringsTable } from '../workbook/shared-strings'; import type { HeaderFooter, PageMargins, PageSetup } from './page-setup'; import type { WebPublishItem } from './web-publish'; import type { Worksheet } from './worksheet'; export interface WorksheetWriteContext { /** Accumulator the writer mutates as it emits string cells. */ sharedStrings: SharedStringsTable; /** * Workbook epoch for `Date` / `{kind:'duration'}` cell serialisation. `true` * = Mac 1904 epoch; `false` (default) = Windows 1900 epoch. Modern Excel * emits 1900-based serials; 1904 only appears in legacy Mac workbooks but the * round-trip respects the workbook setting. */ date1904?: boolean; /** * Worksheet rels collector. The writer pushes a rel per external hyperlink * and per Table, allocating ids `rId1..rIdN`. Caller emits the resulting * relationships file alongside the worksheet part. */ rels?: Relationships; /** * Table rel allocator. saveWorkbook hands in a callback that registers a * table part under a workbook-global tableN counter and returns the relPath * ("../tables/tableN.xml") + the worksheet-rels rId. Called once per * `ws.tables` entry while serialising. */ registerTable?: (table: import('./table').TableDefinition) => { rId: string; }; /** * Comments / VML drawing allocator. saveWorkbook emits the comments part + a * placeholder VML drawing for all comments on the sheet, and returns the * worksheet-rels rId for the VML — which the writer splats into * ``. Called once per worksheet that carries any * comments. */ registerComments?: (comments: ReadonlyArray) => { vmlRelId: string; }; /** * Drawing allocator. saveWorkbook emits xl/drawings/drawingN.xml under a * workbook-global counter, registers a `${REL_NS}/drawing` rel on the * worksheet rels, and returns the worksheet-rels rId — splatted into * `` by the writer. Called once when ws.drawing is set. */ registerDrawing?: (drawing: import('../drawing/drawing').Drawing) => { rId: string; }; } /** * Serialise a worksheet to its `xl/worksheets/sheetN.xml` payload. The function * mutates `ctx.sharedStrings` — every plain-string cell adds (or dedupes) into * the table; the caller is responsible for emitting the resulting sst at the * end of the package write. */ export declare function worksheetToBytes(ws: Worksheet, ctx: WorksheetWriteContext): Uint8Array; /** * Serialise a single cell into its `` element. Exported so the * streaming write-only path can emit cells row-by-row without going through the * full Worksheet model — see src/streaming/write-only.ts. * * Only `ctx.sharedStrings` is consulted for plain-string cells; the other * context fields are used by the worksheet-level serializer that wraps this * helper. */ export declare const serializeCell: (cell: Cell, ctx: WorksheetWriteContext) => string; export declare const serializePageMargins: (pm: PageMargins) => string; export declare const serializePageSetup: (ps: PageSetup) => string | undefined; export declare const serializeWebPublishItems: (items: ReadonlyArray) => string; export declare const serializeHeaderFooter: (hf: HeaderFooter) => string | undefined;