Skip to main content

SetText

Sets the text for the specified characters.

Syntax

expression.SetText(Text);

expression - A variable that represents a ApiCharacters class.

Parameters

NameRequired/OptionalData typeDefaultDescription
TextRequiredstringThe text to be set.

Returns

This method doesn't return any data.

Example

Replace the text of a targeted group of characters inside a cell in a spreadsheet.

// How do I change the actual text stored in a specific character selection within a cell in a spreadsheet?

// Rewrite a defined portion of cell content to reflect updated information in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("B1");
range.SetValue("This is just a sample text.");
let characters = range.GetCharacters(23, 4);
characters.SetText