FontSetting

FontSetting class

Represents a range of characters within the cell text.

class FontSetting;

Example

const { Workbook, Color } = require("aspose.cells.node");

//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
workbook.save("output/FontSetting.xls");

Constructors

ConstructorDescription
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
getStartIndex()@deprecated. Please use the ‘startIndex’ property instead. Gets the start index of the characters.
getLength()@deprecated. Please use the ’length’ property instead. Gets the length of the characters.
getFont()@deprecated. Please use the ‘font’ property instead. Returns the font of this object.
getTextOptions()@deprecated. Please use the ’textOptions’ property instead. Returns the text options.
setWordArtStyle(PresetWordArtStyle)Sets the preset WordArt style.
isNull()Checks whether the implementation object is null.
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;

getStartIndex()

@deprecated. Please use the ‘startIndex’ property instead. Gets the start index of the characters.

getStartIndex() : number;

getLength()

@deprecated. Please use the ’length’ property instead. Gets the length of the characters.

getLength() : number;

getFont()

@deprecated. Please use the ‘font’ property instead. Returns the font of this object.

getFont() : Font;

Returns

Font

getTextOptions()

@deprecated. Please use the ’textOptions’ property instead. Returns the text options.

getTextOptions() : TextOptions;

Returns

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.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;

getType()

Gets the type of text node.

getType() : TextNodeType;

Returns

TextNodeType