Font Settings with Node.js 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 Cells collection. Each item in the Cells 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 Font object’s setName method.
Setting Font Style to Bold
Developers can make text bold by setting the Font object’s setIsBold method to true.
Setting Font Size
Set the font size with the Font object’s setSize method.
Setting Font Color
Use the Font object’s setColor method to set the font color. Select any color from the Color enumeration (part of Node.js) and assign it to the setColor method.
Setting Font Underline Type
Use the Font object’s setUnderline method 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 Font object’s setIsStrikeout method to true.
Setting Subscript Effect
Apply subscript by setting the Font object’s setIsSubscript method to true.
Setting Superscript Effect on Font
Developers can apply the superscript effect on the font by setting the setIsSuperscript method of the Font object to true.
Advance topics
- Apply Superscript and Subscript Effects on Fonts
- Get a List of Fonts used in a Spreadsheet or Workbook