Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

new Google Sheets: set text wrapping to Clip programmatically

There's a new text wrapping mode called Clip in the new Google Sheets.

getWraps()/setWraps() still works with boolean values. When I set wrap value to true, text in that cell is displayed in Overflow mode.

I've found no trace of any new function to set the text wrapping to Clip.

Does anybody know how to deal with that?

like image 817
user3249974 Avatar asked May 30 '15 10:05

user3249974


People also ask

What is clip text wrapping in Google Sheets?

Google Sheets offers three text wrap options: Overflow, Wrap, and Clip. Overflow, the default, extends text over any blank adjacent cells. Wrap maintains column width and extends row height to display all text. Clip truncates the display of text in a cell at the width of the cell.


1 Answers

There's new method available for setting text wrapping strategy: Range.setWrapStrategy(strategy)

Example:

// Sets all cells in range B2:D4 to use the clip wrap strategy.
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("B2:D4");

range.setWrapStrategy(SpreadsheetApp.WrapStrategy.CLIP);
like image 184
Kos Avatar answered Sep 22 '22 18:09

Kos