Get Started
Documentation

SetUnderline

SetUnderline(sUnderline)

Specify that the contents of this cell/cell range are displayed along with a line appearing directly below the character.

Parameters:

Name Type Description
sUnderline string Specifies the type of the line displayed under the characters. The following values are available:
  • "none" - for no underlining;
  • "single" - for the single line underlining the cell contents;
  • "singleAccounting" - for the single line underlining the cell contents but not protruding beyond the cell borders;
  • "double" - for the double line underlining the cell contents;
  • "doubleAccounting" - for the double line underlining the cell contents but not protruding beyond the cell borders.

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A2").SetValue("The text underlined with a single line");
oWorksheet.GetRange("A2").SetUnderline("single");
oWorksheet.GetRange("A4").SetValue("Normal text");
builder.SaveFile("xlsx", "SetUnderline.xlsx");
builder.CloseFile();

Resulting document