0

如何使用 Google Apps 脚本换行?我用过"\n","
,"\r",但都无法实现换行。例如:

function submit(e) {
  var app = UiApp.getActiveApplication();
  var strMessage = "";
  if (e.parameter.Eventtitle == "")
  {
    strMessage = "Event title mustn't be null!";
  }

  if (e.parameter.Fromdate == "")
  {
    strMessage = strMessage + "\n" + "<br>" + "From date mustn't be null!";
  }

  if (e.parameter.Where == "")
  {
    strMessage = strMessage  + "%s\n" + "Where mustn't be null!";
  }

  if (e.parameter.Description == "")
  {
    strMessage = strMessage + "\r\n" + "Description mustn't be null!";
  }

  if (strMessage != "")
  {
    var messageLabel = app.getElementById("message").setText(strMessage);
    messageLabel.setVisible(true);
    return app;
  }
4

1 回答 1

1

我假设messageLabel是一个标签。使用 HTML 小部件而不是标签并<br>用于换行符。

于 2013-06-05T10:36:35.873 回答