如何在新文档上使用DocumentApp.getui() [英] How do i use DocumentApp.getui() on a new doc
本文介绍了如何在新文档上使用DocumentApp.getui()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我一直在尝试制作一个脚本,该脚本可以制作一个文档,然后使用Document.getUi()
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.
推荐答案
收到的错误是:
无法从此上下文中调用DocumentApp.getUi().
Cannot call DocumentApp.getUi() from this context.
这与getUi()
的文档一致:
只有在脚本已绑定到文档的情况下,脚本才可以与UI进行交互."
"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
由于您的脚本创建了一个新文档,因此"doc
"显然不包含在其中-因此,它无法操纵doc
的UI.
Since your script has created a new document, "doc
" it's obviously not contained in it - therefore it cannot manipulate the UI for doc
.
这篇关于如何在新文档上使用DocumentApp.getui()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文