Skip to main content

SetTextToDisplay

Sets the text to be displayed for the hyperlink.

Syntax​

expression.SetTextToDisplay(sText);

expression - A variable that represents an ApiHyperlink class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringThe text to display.

Returns​

This method doesn't return any data.

Example​

Set a new display text for a hyperlink.

// Useful for changing the text shown in a cell for a hyperlink.

// Set a new display text for a hyperlink.

let worksheet = Api.GetActiveSheet();
worksheet.SetHyperlink("A1", "https://onlyoffice.com", null, "ONLYOFFICE", "Visit ONLYOFFICE");

let hyperlink = worksheet.GetHyperlinks()[0];
hyperlink.SetTextToDisplay("Go to ONLYOFFICE");

worksheet.GetRange("A3").SetValue("New display text: " + hyperlink.GetTextToDisplay());