/** * ExternalLinkXform — read and write `xl/externalLinks/externalLinkN.xml`. * * This part describes one external workbook referenced by the current file: * the list of sheets inside the foreign workbook, plus an optional cache of * the primitive values at each referenced address. The `r:id` attribute on * `` points (via the neighbouring `_rels/externalLinkN.xml.rels`) * at the actual file; that resolution is handled by the writer/reader in * `xlsx.browser.ts`, not here. * * Schema shape: * * * * * * * * * (0-based index into sheetNames) * * 123 * hello * * * 1 * * * (no cached values) * * * * * The `t` attribute on `` mirrors the inline-value types used inside a * worksheet's `` element: "n" (number, default), "str" (string), "b" * (boolean), "e" (error). We don't emit shared-string indices here because * the externalLink part is self-contained — each cached string is serialised * inline as plain text inside ``. * * Parser state machine: * externalLink → externalBook → sheetNames → sheetName (stores names in order) * \→ sheetDataSet → sheetData → row → cell → v (values) * * The parser tolerates missing cache data (Excel's `refreshError="1"` mode); * sheets without a matching `` simply have no entry in * `cachedValues`. */ import type { ExternalLinkCachedSheet, ExternalLinkModel } from "../../../workbook.browser.js"; import { BaseXform } from "../base-xform.js"; import type { XmlSink } from "../../../../xml/types.js"; /** * Parsed shape of a single externalLinkN.xml part. Callers (xlsx.browser.ts) * merge `rId` with the matching `workbookRels` entry to recover the model's * `target` / `targetMode`, since those live in the sibling `.rels` file. */ export interface ParsedExternalLink { /** r:id on . Points at the rel inside externalLinkN.xml.rels. */ externalBookRId: string; sheetNames: string[]; cachedValues: Record; } declare class ExternalLinkXform extends BaseXform { /** Sheet name indexed by sheetId (0-based) — filled during parse. */ private sheetNamesByIndex; /** Current sheet's accumulated cached cells. */ private currentSheetCells; /** Current sheet's name (looked up from sheetId). */ private currentSheetName; /** Current cell being parsed: address + type. */ private currentCellAddress; private currentCellType; /** Accumulated text content of the current element. */ private currentCellValue; /** Which element we're currently inside. */ private inV; get tag(): string; reset(): void; render(xmlStream: XmlSink, model: ExternalLinkModel): void; parseOpen(node: any): boolean; parseText(text: string): void; parseClose(name: string): boolean; } export { ExternalLinkXform };