TX Sheet Control

DocumentFontLoadOptions Interface

Interface

Configure document font bytes, asynchronous resolution and family substitutions while loading TX Sheet Control workbooks in TypeScript applications.

Package: @txtextcontrol/tx-sheet-control. This is a type-only contract.

Properties

PropertyDescription
sourcesDocument font bytes supplied by the application before loading.
substitutionsOriginal workbook family to deployed or supplied family. Names in cell formatting are preserved.
resolveOptional asynchronous JavaScript resolver, awaited before document replacement. Return a usable face or undefined to retain the normal font policy.

Example

import { StreamType, type Spreadsheet, type DocumentFontLoadOptions } from '@txtextcontrol/tx-sheet-control';

async function loadInvoice(editor: Spreadsheet, inputBytes: Uint8Array, fontBase64: string) {
    const fonts: DocumentFontLoadOptions = {
        resolve: async request => ({
            family: request.family,
            bold: request.bold,
            italic: request.italic,
            base64: fontBase64
        })
    };
    await editor.load(inputBytes, StreamType.OpenDocumentSpreadsheet, { fonts });
}

Font registration is scoped to the loaded document. The shared renderer uses the same faces for editor layout and PDF output. A load failure or cancellation retains the existing workbook.