Font Settings

Configuring Font Settings

Aspose.Cells for Python via .NET provides a class, Workbook that represents a Microsoft Excel file. The Workbook class contains a worksheets collection that allows access to each worksheet in an Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a cells collection. Each item in the cells collection represents an object of the Cell class.

Aspose.Cells provides the Cell class' get_style and set_style methods which are used to get and set a cell’s formatting style. The Style class provides properties for configuring font settings.

Setting Font Name

Developers can apply any font to text inside a cell by using the Style.font object’s Name property.

Setting Font Style to Bold

Developers can make text bold by setting the Style.font object’s is_bold property to true.

Setting Font Size

Set the font size with the Style.font object’s size property.

Setting Font Color

Use the Style.font object’s color property to set the font color. Select any color from the Color enumeration (part of the .NET framework) and assign it to the color property.

Setting Font Underline Type

Use the Style.font object’s underline property to underline text. Aspose.Cells for Python via .NET offers various pre-defined font underline types in the FontUnderlineType enumeration.

Font Underline Types Description
ACCOUNTING A single accounting underline
DOUBLE Double underline
DOUBLE_ACCOUNTING Double accounting underline
NONE No underline
SINGLE A single underline

Setting Strikeout Effect

Apply strikeout by setting the Style.font object’s is_strikeout property to true.

Setting Subscript Effect

Apply subscript by setting the Style.font object’s is_sub_script property to true.

Setting Superscript Effect on Font

Developers can apply the superscript effect on the font by setting the is_superscript property of the Style.font object to true.

Advance topics