Font class

Font class

Encapsulates the font object used in a spreadsheet.

The Font type exposes the following members:

Properties

PropertyDescription
charsetRepresent the character set.
is_italicGets or sets a value indicating whether the font is italic.
is_boldGets or sets a value indicating whether the font is bold.
caps_typeGets and sets the text caps type.
strike_typeGets the strike type of the text.
is_strikeoutGets or sets a value indicating whether the font is single strikeout.
script_offsetGets and sets the script offset,in unit of percentage
is_superscriptGets or sets a value indicating whether the font is super script.
is_subscriptGets or sets a value indicating whether the font is subscript.
underlineGets or sets the font underline type.
nameGets or sets the name of the Font.
double_sizeGets and sets the double size of the font.
sizeGets or sets the size of the font.
theme_colorGets and sets the theme color.
colorGets or sets the Color of the font.
argb_colorGets and sets the color with a 32-bit ARGB value.
is_normalize_heightsIndicates whether the normalization of height that is to be applied to the text run.
scheme_typeGets and sets the scheme type of the font.

Methods

MethodDescription
equalsChecks if two fonts are equals.

Example

from aspose.cells import Workbook
from aspose.pydrawing import Color

# Instantiating a Workbook object
workbook = Workbook()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.worksheets[0]
# Accessing the "A1" cell from the worksheet
cell = worksheet.cells.get("A1")
# Adding some value to the "A1" cell
cell.put_value("Hello Aspose!")
font = cell.get_style().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 = Color.red
# Saving the Excel file
workbook.save(r"dest.xls")

See Also