Get Started
Usage API

SetName

SetName(sName) → { Error | true }

Sets a String value representing the name of the object.

Parameters:

Name Type Description
sName string

new name for range

Returns:

Type
Error | true

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A1").SetValue("1");
oWorksheet.GetRange("B1").SetValue("2");
Api.AddDefName("name", "Sheet1!$A$1:$B$1");
oDefName = Api.GetDefName("name");
oDefName.SetName("new_name");
oNewDefName = Api.GetDefName("new_name");
oWorksheet.GetRange("A3").SetValue("The new name of the range: " + oNewDefName.GetName());
builder.SaveFile("xlsx", "SetName.xlsx");
builder.CloseFile();

Resulting document