FontConfigs.GetFontFileDataInfo
FontConfigs.GetFontFileDataInfo method
Get data information of font file data.
public static FontFileDataInfo GetFontFileDataInfo(string fontName, bool isBold, bool isItalic,
bool isExactStyle)
| Parameter | Type | Description |
|---|---|---|
| fontName | String | font name |
| isBold | Boolean | the font style is bold or not |
| isItalic | Boolean | the font style is italic or not |
| isExactStyle | Boolean | whether to match the given bold/italic style exactly |
Return Value
Data infomation of font file data.
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class FontConfigsMethodGetFontFileDataInfoWithStringBooleanBooleanBooleanDemo
{
public static void Run()
{
try
{
// Call GetFontFileDataInfo with specific parameters (changed to static call)
FontFileDataInfo fontInfo = FontConfigs.GetFontFileDataInfo("Arial", true, false, false);
// Display information about the font file data
if (fontInfo != null)
{
Console.WriteLine($"Font format type: {fontInfo.FormatType}");
Console.WriteLine($"Font data length: {fontInfo.Data?.Length ?? 0} bytes");
}
else
{
Console.WriteLine("Font information not available");
}
// Demonstrate effect on a workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Set style with the font we checked
Style style = workbook.CreateStyle();
style.Font.Name = "Arial";
style.Font.IsBold = true;
style.Font.IsItalic = false;
// Apply style to a cell
worksheet.Cells["A1"].SetStyle(style);
worksheet.Cells["A1"].PutValue("Text with Arial Bold");
// Save the workbook
workbook.Save("FontConfigsDemo.xlsx");
}
catch (Exception ex)
{
Console.WriteLine($"Error executing GetFontFileDataInfo method: {ex.Message}");
}
}
}
}
See Also
- class FontFileDataInfo
- class FontConfigs
- namespace Aspose.Cells
- assembly Aspose.Cells