FontSetting

FontSetting class

Represents a range of characters within the cell text.

class FontSetting;

Example

const { Workbook, Color, SaveFormat } = AsposeCells;

//Instantiating a Workbook object
var workbook = new Workbook();
//Adding a new worksheet to the Excel object
workbook.worksheets.add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.worksheets.get(0);
//Accessing the "A1" cell from the worksheet
var cell = worksheet.cells.get("A1");
//Adding some value to the "A1" cell
cell.putValue("Visit Aspose!");
//getting charactor
var charactor = cell.characters(6, 7);
//Setting the font of selected characters to bold
charactor.font.isBold = true;
//Setting the font color of selected characters to blue
charactor.font.color = Color.Blue;
//Saving the Excel file
var uint8Array = workbook.save(SaveFormat.Xlsx);

Constructors

NameDescription
constructor(number, number, WorksheetCollection)

Properties

PropertyTypeDescription
startIndexnumberReadonly. Gets the start index of the characters.
lengthnumberReadonly. Gets the length of the characters.
fontFontReadonly. Returns the font of this object.
textOptionsTextOptionsReadonly. Returns the text options.

Methods

MethodDescription
setWordArtStyle(PresetWordArtStyle)Sets the preset WordArt style.
getType()Gets the type of text node.

constructor(number, number, WorksheetCollection)

constructor(startIndex: number, length: number, sheets: WorksheetCollection);

Parameters:

ParameterTypeDescription
startIndexnumber
lengthnumber
sheetsWorksheetCollection

startIndex

Readonly. Gets the start index of the characters.

startIndex : number;

length

Readonly. Gets the length of the characters.

length : number;

font

Readonly. Returns the font of this object.

font : Font;

textOptions

Readonly. Returns the text options.

textOptions : TextOptions;

setWordArtStyle(PresetWordArtStyle)

Sets the preset WordArt style.

setWordArtStyle(style: PresetWordArtStyle) : void;

Parameters:

ParameterTypeDescription
stylePresetWordArtStyleThe preset WordArt style.

Remarks

Only for the text of shape/chart.

getType()

Gets the type of text node.

getType() : TextNodeType;

Returns

TextNodeType