Class FontSourceBase

FontSourceBase class

This is an abstract base class for the classes that allow the user to specify various font sources

public abstract class FontSourceBase

Properties

NameDescription
abstract Type { get; }Returns the type of the font source.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class CellsClassFontSourceBaseDemo
    {
        public static void Run()
        {
            // Create a folder font source
            string fontFolder = @"C:\Windows\Fonts";
            FolderFontSource folderSource = new FolderFontSource(fontFolder, true);

            // Display font source properties
            Console.WriteLine($"Font folder: {folderSource.FolderPath}");
            Console.WriteLine($"Scan subfolders: {folderSource.ScanSubFolders}");
            Console.WriteLine($"Source type: {folderSource.Type}");

            // Create workbook and set font source
            Workbook workbook = new Workbook();
            FontConfigs.SetFontSources(new FontSourceBase[] { folderSource });

            // Save with custom fonts
            workbook.Save("OutputWithCustomFonts.xlsx");
        }
    }
}

See Also