TX Sheet Control

DocumentFontSource Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll

Configure document-local TrueType font resources and substitutions for TX Sheet Control loading and saving without installing operating-system fonts.

Members

MemberDescription
FamilyOriginal font family.
Base64Base64 TrueType-outline bytes, limited to 32 MiB per face.
BoldBold face; omitted infers font metadata.
ItalicItalic face; omitted infers font metadata.
AliasesAdditional original workbook family names.
FallbackSupply missing glyphs without replacing an available primary face.
ConstructorCreate document font settings.

Constructor

Create settings with an object initializer before loading or saving a workbook.

Example

using TXTextControl.TXSheetControl.Server;

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