Class Font
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates the font object used in a spreadsheet.
public class Font
Inheritance
Derived
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
csharp
[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");
'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")
Properties
ArgbColor
Gets and sets the color with a 32-bit ARGB value.
public int ArgbColor { get; set; }
Property Value
CapsType
Gets and sets the text caps type.
public TextCapsType CapsType { get; set; }
Property Value
Charset
Represent the character set.
public int Charset { get; set; }
Property Value
Color
Gets or sets the System.Drawing.Color of the font.
public Color Color { get; set; }
Property Value
DoubleSize
Gets and sets the double size of the font.
public double DoubleSize { get; set; }
Property Value
IsBold
Gets or sets a value indicating whether the font is bold.
public bool IsBold { get; set; }
Property Value
IsItalic
Gets or sets a value indicating whether the font is italic.
public bool IsItalic { get; set; }
Property Value
IsNormalizeHeights
Indicates whether the normalization of height that is to be applied to the text run.
public bool IsNormalizeHeights { get; set; }
Property Value
IsStrikeout
Gets or sets a value indicating whether the font is single strikeout.
public bool IsStrikeout { get; set; }
Property Value
IsSubscript
Gets or sets a value indicating whether the font is subscript.
public bool IsSubscript { get; set; }
Property Value
IsSuperscript
Gets or sets a value indicating whether the font is super script.
public bool IsSuperscript { get; set; }
Property Value
Name
Gets or sets the name of the Aspose.Cells.Font.
public virtual string Name { get; set; }
Property Value
SchemeType
Gets and sets the scheme type of the font.
public FontSchemeType SchemeType { get; set; }
Property Value
ScriptOffset
Gets and sets the script offset,in unit of percentage
public double ScriptOffset { get; set; }
Property Value
Size
Gets or sets the size of the font.
public int Size { get; set; }
Property Value
StrikeType
Gets the strike type of the text.
public TextStrikeType StrikeType { get; set; }
Property Value
ThemeColor
Gets and sets the theme color.
public ThemeColor ThemeColor { get; set; }
Property Value
Remarks
If the font color is not a theme color, NULL will be returned.
Underline
Gets or sets the font underline type.
public FontUnderlineType Underline { get; set; }
Property Value
Methods
Equals(Font)
Checks if two fonts are equals.
public bool Equals(Font font)
Parameters
font
Font
Compared font object.
Returns
True if equal to the compared font object.
ToString()
Returns a string represents the current Cell object.
public override string ToString()