TX Sheet Control

LoadOptions.Fonts Property

Property
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server as TXTextControl.TXSheetControl.Api.dll from the private NuGet feed or the supplied NuGet folder
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll

Settings for this operation. The application can obtain font bytes immediately before calling LoadAsync or SaveAsync. JavaScript resolver delegates are not serialized into the managed transport.

Syntax

using TXTextControl.TXSheetControl.Server;

var fonts = new DocumentFontOptions {
    Sources = [new DocumentFontSource {
        Family = "Invoice Sans",
        Base64 = Convert.ToBase64String(await File.ReadAllBytesAsync("InvoiceSans-Regular.ttf"))
    }]
};
await control.LoadAsync("invoice.xlsx", StreamType.SpreadsheetML,
    new LoadOptions { Fonts = fonts });

Example

using TXTextControl.TXSheetControl.Server;

static async Task ConfigureInvoiceFontsAsync(ServerSheetControl control, string fontPath)
{
    var fonts = new DocumentFontOptions {
        Sources = [new DocumentFontSource {
            Family = "Invoice Sans",
            Base64 = Convert.ToBase64String(await File.ReadAllBytesAsync(fontPath))
        }]
    };
    await control.LoadAsync("invoice.xlsx", StreamType.SpreadsheetML,
        new LoadOptions { Fonts = fonts });
}