Retrieving Font Information
Contents
[
Hide
]
VSTO
Below is the code for retrieving font information:
foreach (Font font in Application.ActiveDocument.Fonts)
{
//Display information about the fonts
MessageBox.Show(font.Name);
}
Aspose.Diagram
Aspose.Diagram has mechanisms for retrieving information about the elements that make up a diagram, from pages, stencils, connectors and also fonts. This article shows how to find out which fonts are used in a diagram.
The Font object represents a typeface that is either applied to text in a document or available for use on the system.
A Font object maps a name (for example, “Arial”) to the font ID (for example, 3) that Microsoft Visio stores in a Font cell in a Character section of a shape that contains text formatted with that font. Font IDs can change when a document is opened on different systems or when fonts are installed or removed.
//Call the diagram constructor to load diagram from a VDX file
Diagram vdxDiagram = new Diagram(@"E:\Aspose\Aspose Vs VSTO\Aspose.Diagram Vs VSTO Visio v1.1\Sample Files\Drawing1.vdx");
foreach (Aspose.Diagram.Font font in vdxDiagram.Fonts)
{
//Display information about the fonts
Console.WriteLine(font.Name);
}