【发布时间】:2011-10-26 03:38:02
【问题描述】:
如何通过 Google Apps 脚本将图像添加到 Google 文档(不是电子表格或演示文稿)。我没有看到 addImage 方法。团队肯定不会遗漏这一点。
http://code.google.com/googleapps/appsscript/class_document.html
【问题讨论】:
标签: google-docs google-apps-script
如何通过 Google Apps 脚本将图像添加到 Google 文档(不是电子表格或演示文稿)。我没有看到 addImage 方法。团队肯定不会遗漏这一点。
http://code.google.com/googleapps/appsscript/class_document.html
【问题讨论】:
标签: google-docs google-apps-script
来自文档:
function insertImage() {
// Retrieve an image from the web.
var resp = UrlFetchApp.fetch("http://www.google.com/intl/en_com/images/srpr/logo2w.png");
// Create a document.
var doc = DocumentApp.openById("");
// Append the image to the first paragraph.
doc.getChild(0).asParagraph().appendInlineImage(resp.getBlob());
}
http://code.google.com/googleapps/appsscript/class_documentapp_listitem.html#appendInlineImage
我不确定您是否可以上传图片。但是您肯定可以通过 url 将其插入到段落中。
【讨论】: