0

textArea のテキストを置き換える必要があります。何が間違っていますか?

function doGet() {
  var app = UiApp.createApplication();
  var textArea = app.createTextArea()
  .setText('here is text... here is text... here is text...')
  .setName('theText').setId('theText')
  .addClickHandler(app.createServerHandler('processing'));
  app.add(textArea);
  return app;
}

function processing(e) {
  Logger.log(e.parameter.theText); // In Log I see: 'here is text... here is text... here is text...'
  var textIn = e.parameter.theText;
  var textOut = textIn.replaceText('/[text]/', 'new text'); // Here I get error: Unable to find a function replaseText in the object here is text... here is text... here is text....
  var app = UiApp.getActiveApplication();
  app.getElementById('theText').setText(textOut);
  return app;  
}

「e.parameter.theText」でgetText、getBody、editAsTextなどを試しましたが、同じ結果になりました。間違いはどこにありますか?

4

1 に答える 1

1

replaceメソッドは単純で、 これは純粋なJavaScriptreplaceではありません。DocumentAppと Javascript の文字列操作を 混同しているようです。replaceText

于 2013-11-06T21:03:36.343 に答える