ApiCharacters

new ApiCharacters()

Class representing characters in an object that contains text.

Properties

Name Type Description
Count number

The number of characters in the collection.

Parent ApiRange

The parent object of the specified characters.

Caption string

The text of the specified range of characters.

Text string

The string value representing the text of the specified range of characters.

Font ApiFont

The font of the specified characters.

Methods

Name Description
Delete

Deletes the ApiCharacters object.

GetCaption

Returns a string value that represents the text of the specified range of characters.

GetCount

Returns a value that represents a number of objects in the collection.

GetFont

Returns the ApiFont object that represents the font of the specified characters.

GetParent

Returns the parent object of the specified characters.

GetText

Returns the text of the specified range of characters.

Insert

Inserts a string replacing the specified characters.

SetCaption

Sets a string value that represents the text of the specified range of characters.

SetText

Sets the text for the specified characters.

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("B1");
oRange.SetValue("This is just a sample text.");
var oCharacters = oRange.GetCharacters(16, 6);
var oFont = oCharacters.GetFont();
oFont.SetBold(true);
var sCaption = oCharacters.GetCaption();
oWorksheet.GetRange("B3").SetValue("Caption: " + sCaption);
var sText = oCharacters.GetText();
oWorksheet.GetRange("B4").SetValue("Text: " + sText);
var nCount = oCharacters.GetCount();
oWorksheet.GetRange("B5").SetValue("Number of characters: " + nCount);
var oParent = oCharacters.GetParent();
oParent.SetBorders("Bottom", "Thick", Api.CreateColorFromRGB(255, 111, 61));
oCharacters = oRange.GetCharacters(23, 4);
oCharacters.Insert("string");
oCharacters = oRange.GetCharacters(9, 4);
oCharacters.Delete();
builder.SaveFile("xlsx", "ApiCharacters.xlsx");
builder.CloseFile();

Resulting document