Strike line

Here is a tip how to edit strike line property.

 

Source code

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

  // Set strike line property = true
  ss.getActiveRange().setFontLine("line-through");

  // Set strike 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” -> strike line property = true

+ “none” -> strike line property = false

 

Responses

None

 

How to check strike line status?

GAS supplies a function to get the status of that.

Here is source code.

function checkStrike(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getActiveSheet();
  var rs = ss.getActiveRange().getTextStyle().isStrikethrough();
  Browser.msgBox("Strike: " + rs);
}

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

RangeObject.getTextStyle().isStrikethrough()

 

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