Skip to main content

SetSuperscript

Sets the superscript property to the specified font. 💡 This method will work only with the text format of the cell.

Syntax

expression.SetSuperscript(isSuperscript);

expression - A variable that represents a ApiFont class.

Parameters

NameRequired/OptionalData typeDefaultDescription
isSuperscriptRequiredbooleanSpecifies that the text characters are displayed superscript.

Returns

This method doesn't return any data.

Example

Raise selected text characters above the baseline as superscript in a spreadsheet.

// How do I format part of the text as superscript in a spreadsheet?

// Lift a run of characters upward to create superscript notation in a spreadsheet.

const worksheet = Api.GetActiveSheet();
const range = worksheet.GetRange("B1");
range.SetValue("This is just a sample text.");
const characters = range.GetCharacters(9, 4);
const font = characters.GetFont();
font.SetSuperscript(true);