Aspose::Cells::FontSetting class

FontSetting class

Represents a range of characters within the cell text.

class FontSetting

Methods

MethodDescription
FontSetting(int32_t startIndex, int32_t length, const WorksheetCollection& sheets)
FontSetting(FontSetting_Impl* impl)Constructs from an implementation object.
FontSetting(const FontSetting& src)Copy constructor.
GetFont()Returns the font of this object.
GetLength()Gets the length of the characters.
GetStartIndex()Gets the start index of the characters.
GetTextOptions()Returns the text options.
GetType()Gets the type of text node.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const FontSetting& src)operator=
SetWordArtStyle(PresetWordArtStyle style)Sets the preset WordArt style.
~FontSetting()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;

//Adding a new worksheet to the Excel object
workbook.GetWorksheets().Add();

//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.GetWorksheets().Get(0);

//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.GetCells().Get(u"A1");

//Adding some value to the "A1" cell
cell.PutValue(u"Visit Aspose!");

//getting charactor
FontSetting charactor = cell.Characters(6, 7);

//Setting the font of selected characters to bold
charactor.GetFont().SetIsBold(true);

//Setting the font color of selected characters to blue
charactor.GetFont().SetColor(Color{ 0xff, 0, 0, 0xff });//Blue

//Saving the Excel file
workbook.Save(u"book1.xls");

Aspose::Cells::Cleanup();

See Also