/** * Parse / serialize SpreadsheetML rich-text runs (`CT_RElt` / `CT_RPrElt`). * * Citations: * - ECMA-376-1 §18.4 Shared String Table * - Transitional `sml.xsd`: `CT_Rst`, `CT_RElt`, `CT_RPrElt` * - Path: `specs/schemas/xsd/OfficeOpenXML-XMLSchema-Transitional/sml.xsd` * * Run typeface uses `rFont` (not styles-table `font/name`). * * @private */ import { Font as FontInput } from '../styles/styles-xml'; /** * One rich-text run: text plus optional run properties. */ export interface RichTextRun { readonly text: string; readonly font?: FontInput; } /** * Join run texts into the plain fallback string. */ export declare function joinRunText(runs: ReadonlyArray): string; /** * True when any run carries explicit font properties. */ export declare function runsHaveFont(runs: ReadonlyArray): boolean; /** * Snapshot `FontInput` (strip undefined; deep-copy color). */ export declare function snapshotFontInput(input: FontInput | undefined): FontInput | undefined; /** * Canonical key for coalescing adjacent runs with equal fonts. */ export declare function fontInputMatchKey(font: FontInput | undefined): string; /** * Coalesce adjacent runs that share the same font key. */ export declare function coalesceRuns(runs: ReadonlyArray): RichTextRun[]; /** * Expand runs to per-code-unit fonts, assign inclusive range, coalesce. */ export declare function applyFontToRange(runs: ReadonlyArray, start: number, end: number, font: FontInput | undefined): RichTextRun[]; /** * Parse runs from a full `…` or `…` element, or inner XML. * Phonetic (`rPh` / `phoneticPr`) and unknown children are skipped on rebuild. */ export declare function parseRichRunsFromSiXml(siOrInnerXml: string): RichTextRun[]; /** * Serialize runs to a full `…` element (`CT_Rst` with `r*` only). */ export declare function serializeRichSiXml(runs: ReadonlyArray): string; /** * Parse `CT_RPrElt` (`rPr`). */ export declare function parseRPrElement(rPrXml: string): FontInput; /** * Serialize `CT_RPrElt` with `rFont` for typeface. */ export declare function serializeRPrElement(font: FontInput): string;