Font Settings with Golang via C++
Configuring Font Settings
Aspose.Cells 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 GetCells() collection. Each item in the GetCells() collection represents an object of the Cell class.
Aspose.Cells provides the Cell class' GetStyle and SetStyle 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.GetFont() object’s GetName() property.
Setting Font Style to Bold
Developers can make text bold by setting the Style.GetFont() object’s IsBold property to true.
Setting Font Size
Set the font size with the Style.GetFont() object’s GetSize() property.
Setting Font Color
Use the Style.GetFont() object’s GetColor() property to set the font color. Select any color from the Color enumeration (part of the C++ framework) and assign it to the GetColor() property.
Setting Font Underline Type
Use the Style.GetFont() object’s GetUnderline() property to underline text. Aspose.Cells offers various pre-defined font underline types in the FontUnderlineType enumeration.
Font Underline Types | Description |
---|---|
Accounting | A single accounting underline |
Double | Double underline |
DoubleAccounting | Double accounting underline |
None | No underline |
Single | A single underline |
Setting Strikeout Effect
Apply strikeout by setting the Style.GetFont() object’s IsStrikeout property to true.
Setting Subscript Effect
Apply subscript by setting the Style.GetFont() object’s IsSubScript property to true.
Setting Superscript Effect on Font
Developers can apply the superscript effect on the font by setting the IsSuperscript property of the Style.GetFont() object to true.