DocumentFontLoadOptions.resolve Property
Optional asynchronous JavaScript resolver, awaited before document replacement. Return a usable face or undefined to retain the normal font policy.
Syntax
resolve?: (request: FontResolutionRequest) => DocumentFontSource | undefined | Promise<DocumentFontSource | undefined>;
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 });
}