How do i use DocumentApp.getui() on a new doc

别等时光非礼了梦想. 提交于 2019-12-11 05:37:52

问题


So i have been trying to make a script that makes a doc and then uses Document.getUi()

var doc = DocumentApp.create('New')
var Func = DocumentApp.getUi() //Blah blah blah

but when I do this it gives me an error how can i fix this.


回答1:


The error received is:

Cannot call DocumentApp.getUi() from this context.

This is consistent with the documentation for getUi():

"A script can only interact with the UI for the current instance of an open document, and only if the script is bound to the document."ref

Since your script has created a new document, "doc" it's obviously not contained in it - therefore it cannot manipulate the UI for doc.



来源:https://stackoverflow.com/questions/19920041/how-do-i-use-documentapp-getui-on-a-new-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!