Class FolderFontSource

FolderFontSource class

Represents the folder that contains TrueType font files.

public class FolderFontSource : FontSourceBase

Constructors

NameDescription
FolderFontSource(string, bool)Ctor.

Properties

NameDescription
FolderPath { get; }Path to fonts folder.
ScanSubFolders { get; }Determines whether or not to scan the subfolders.
override Type { get; }Returns the type of the font source.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class FolderFontSourceDemo
    {
        public static void FolderFontSourceExample()
        {
            // Create an instance of FolderFontSource
            string folderPath = @"C:\Fonts";
            bool scanSubfolders = true;
            FolderFontSource folderFontSource = new FolderFontSource(folderPath, scanSubfolders);

            // Accessing properties
            Console.WriteLine("Folder Path: " + folderFontSource.FolderPath);
            Console.WriteLine("Scan Subfolders: " + folderFontSource.ScanSubFolders);
            Console.WriteLine("Font Source Type: " + folderFontSource.Type);

            // Create a workbook and set the font sources
            Workbook workbook = new Workbook();
            FontConfigs.SetFontSources(new FontSourceBase[] { folderFontSource });

            // Save the workbook
            workbook.Save("FolderFontSourceExample.xlsx");
            workbook.Save("FolderFontSourceExample.pdf");
            return;
        }
    }
}

See Also