GemBox.Spreadsheet is a .NET component that enables you to read, write, edit, convert, and print spreadsheet files from your .NET applications using one simple API.

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.

Screenshot
Private Fonts Screenshot

See the full code below, use Run Example to execute.

using System;
using System.Collections.Generic;
using System.Text;
using GemBox.Spreadsheet;
using GemBox.Spreadsheet.ConditionalFormatting;
using GemBox.Spreadsheet.PivotTables;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

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

        string pathToResources = "Resources";

        FontSettings.FontsBaseDirectory = pathToResources;

        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 System
Imports System.Collections.Generic
Imports System.Text
Imports GemBox.Spreadsheet
Imports GemBox.Spreadsheet.ConditionalFormatting
Imports GemBox.Spreadsheet.PivotTables

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

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

        Dim pathToResources As String = "Resources"

        FontSettings.FontsBaseDirectory = pathToResources

        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 sample.