Class Font
Contents
[
Hide
]Font class
Encapsulates the font object used in a spreadsheet.
public class Font
Properties
Name | Description |
---|---|
ArgbColor { get; set; } | Gets and sets the color with a 32-bit ARGB value. |
CapsType { get; set; } | Gets and sets the text caps type. |
Charset { get; set; } | Represent the character set. |
Color { get; set; } | Gets or sets the Color of the font. |
DoubleSize { get; set; } | Gets and sets the double size of the font. |
IsBold { get; set; } | Gets or sets a value indicating whether the font is bold. |
IsItalic { get; set; } | Gets or sets a value indicating whether the font is italic. |
IsNormalizeHeights { get; set; } | Indicates whether the normalization of height that is to be applied to the text run. |
IsStrikeout { get; set; } | Gets or sets a value indicating whether the font is single strikeout. |
IsSubscript { get; set; } | Gets or sets a value indicating whether the font is subscript. |
IsSuperscript { get; set; } | Gets or sets a value indicating whether the font is super script. |
virtual Name { get; set; } | Gets or sets the name of the Font . |
SchemeType { get; set; } | Gets and sets the scheme type of the font. |
ScriptOffset { get; set; } | Gets and sets the script offset,in unit of percentage |
Size { get; set; } | Gets or sets the size of the font. |
StrikeType { get; set; } | Gets the strike type of the text. |
ThemeColor { get; set; } | Gets and sets the theme color. |
Underline { get; set; } | Gets or sets the font underline type. |
Methods
Name | Description |
---|---|
Equals(Font) | Checks if two fonts are equals. |
override ToString() | Returns a string represents the current Cell object. |
Examples
[C#]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
//Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
Aspose.Cells.Font font = cell.GetStyle().Font;
//Setting the font name to "Times New Roman"
font.Name = "Times New Roman";
//Setting font size to 14
font.Size = 14;
//setting font color as Red
font.Color = System.Drawing.Color.Red;
//Saving the Excel file
workbook.Save(@"dest.xls");
[VB.NET]
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(0)
'Accessing the "A1" cell from the worksheet
Dim cell As Aspose.Cells.Cell = worksheet.Cells("A1")
'Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!")
Dim font As Aspose.Cells.Font = cell.GetStyle().Font
'Setting the font name to "Times New Roman"
font.Name = "Times New Roman"
'Setting font size to 14
font.Size = 14
'setting font color as Red
font.Color = System.Drawing.Color.Red
'Saving the Excel file
workbook.Save("dest.xls")
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells