Under line

Here is a tip how to edit under line property.

 

Source code

function setStyleUnderline() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getActiveSheet();

  // Set under line property = true
  ss.getActiveRange().setFontLine("underline");

  // Set under line property = false
  ss.getActiveRange().setFontLine("none");
}

 

Format

RangeObject.setFontLine(fontLine)

 

Parameters

fontLine … You can enter only 2 values like the following them;

+ “line-through” -> under line property = true

+ “none” -> under line property = false

 

Responses

None

 

How to check under line status?

GAS supplies a function to get the status of that.

Here is source code.

function checkUnderline(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getActiveSheet();
  var rs = ss.getActiveRange().getTextStyle().isUnderline();
  Browser.msgBox("Underline: " + rs);
}

The following is the format. This function returns “true” or “false”.

RangeObject.getTextStyle().isUnderline()

 

How to get a range’s object?

Please refer the following tips.

Get an active range object

Get a range object by row & column number

Get a range object by address

Leave a Comment