Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>if you use those <a href="https://developers.google.com/apps-script/class_label#setWordWrap" rel="nofollow">2 parameters</a> you do what you want don't you ?</p> <pre><code>app.createLabel(text).setWidth(width).setWordWrap(true) </code></pre> <p>here is an example (among other widgets ;-):</p> <pre><code>function showurl() { var app = UiApp.createApplication(); app.setTitle("Anchor in a popup ;-)"); var panel = app.createFlowPanel() var image = app.createImage('https://sites.google.com/site/appsscriptexperiments/home/photo.jpg').setPixelSize(50, 50) var link = app.createAnchor('This is your link', 'https://sites.google.com/site/appsscriptexperiments/home'); var lab = app.createLabel("wrap it because it's too narrow").setWidth(90).setWordWrap(true); var quit = app.createButton('quit'); panel.add(image).add(link).add(lab).add(quit); app.add(panel); var doc = SpreadsheetApp.getActive(); doc.show(app); } </code></pre> <p>EDIT : I found an <a href="http://productforums.google.com/forum/#!searchin/apps-script/break%2420line%2420toast/apps-script/AaUea3SRPto/DnoRr6sR4xsJ" rel="nofollow">old post</a>(on the Google group forum, thanks again Henrique ;-) about breaking lines in toast messages and here is the code I used for that case... the principle should work for Labels too but I didn't try. To use it, just use \n (where you want to break the line) in a variable containing your text and pass it through this function. (there are some comment in the script to explain)</p> <pre><code>function break_(msg){ var temp = escape(msg);// shows codes of all chars msg = unescape(temp.replace(/%20/g,"%A0")); // replace spaces by non break spaces temp = msg.replace("\n"," "); // and replace the 'newline' by a normal space return temp; // send back the result } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload