Private Fonts

GemBox.Spreadsheet enables you to specify the location where it should look for font files when saving a spreadsheet to PDF, XPS or image file formats, printing a spreadsheet, or converting it to XpsDocument or ImageSource instances as in the following example.

This feature is especially useful for ASP.NET applications working in Medium Trust environment. By specifying a location that is under your ASP.NET application's control, GemBox.Spreadsheet can use file system operations to retrieve font data even in Medium Trust environment.

By default, if location is not specified, GemBox.Spreadsheet will look for font files in default font directory for the operating system.

Font file: Almonte Snow.ttf.

Private Fonts Screenshot
using GemBox.Spreadsheet;

class Program
    static void Main(string[] args)
        // If using Professional version, put your serial key below.

        ExcelFile ef = new ExcelFile();
        ExcelWorksheet ws = ef.Worksheets.Add("Private Fonts");

        FontSettings.FontsBaseDirectory = ".";

        ws.Parent.Styles.Normal.Font.Name = "Almonte Snow";
        ws.Cells[0, 0].Value = "Hello World!";

        ef.Save("Private Fonts.pdf", new PdfSaveOptions() { SelectionType = SelectionType.EntireFile });
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.

        Dim ef As ExcelFile = New ExcelFile
        Dim ws As ExcelWorksheet = ef.Worksheets.Add("Private Fonts")

        FontSettings.FontsBaseDirectory = "."

        ws.Parent.Styles.Normal.Font.Name = "Almonte Snow"
        ws.Cells(0, 0).Value = "Hello World!"
        ef.Save("Private Fonts.pdf", New PdfSaveOptions() With {.SelectionType = SelectionType.EntireFile})

    End Sub

End Module

Check next example or download examples from GitHub.