XlsxExportOptions.Fonts Property
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.asTXSheetControl. Server TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Api. dll
- Also in
TXTextControl.asTXSheetControl. Blazor 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.SaveAsync("invoice.xlsx", StreamType.SpreadsheetML,
new SaveOptions { SpreadsheetML = new XlsxExportOptions { 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.SaveAsync("invoice.xlsx", StreamType.SpreadsheetML,
new SaveOptions { SpreadsheetML = new XlsxExportOptions { Fonts = fonts } });
}