TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SUBSTITUTE

SUBSTITUTE(arg1, arg2, arg3, arg4) → { string }

Replaces existing text with new text in a text string.

Parameters:

Name Type Description
arg1 string

The text or the reference to a cell containing text in which the characters will be substituted.

arg2 string

The existing text to replace. If the case of the original text does not match the case of text, the function will not replace the text.

arg3 string

The text to replace the original text with.

arg4 string

Specifies which occurrence of the original text to replace. If omitted, every instance of the original text will be replaced.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.SUBSTITUTE("Online Office is a cloud business service portal", "Office", "portal"));
builder.SaveFile("xlsx", "SUBSTITUTE.xlsx");
builder.CloseFile();

Resulting document