Javascript '中的错误;附录列表项';-谷歌插件
我正在尝试将listItem从一个google文档复制到其他文档 代码如下:Javascript '中的错误;附录列表项';-谷歌插件,javascript,google-apps-script,google-docs-api,google-developer-tools,Javascript,Google Apps Script,Google Docs Api,Google Developer Tools,我正在尝试将listItem从一个google文档复制到其他文档 代码如下: var activeDocID=DocumentApp.getActiveDocument().getId(); var targetBody = DocumentApp.openById(activeDocID).getBody(); for (i = 0; i < docCopy.getBody().getNumChildren(); i++) { var element =do
var activeDocID=DocumentApp.getActiveDocument().getId();
var targetBody = DocumentApp.openById(activeDocID).getBody();
for (i = 0; i < docCopy.getBody().getNumChildren(); i++)
{
var element =docCopy.getBody().getChild(i).copy();
var type = element.getType();
if (type == DocumentApp.ElementType.PARAGRAPH)
{
if (element.asParagraph().getNumChildren() != 0 && element.asParagraph().getChild(0).getType() == DocumentApp.ElementType.INLINE_IMAGE)
{
var blob = element.asParagraph().getChild(0).asInlineImage().getBlob();
targetBody.appendImage(blob);
}
else
targetBody.appendParagraph(element.asParagraph());
}
else if( type == DocumentApp.ElementType.TABLE){
targetBody.appendTable(element);
}
else if( type == DocumentApp.ElementType.INLINE_IMAGE) {
var image = element.asInlineImage().getBlob();
targetBody.appendImage(image);
}
else if( type == DocumentApp.ElementType.LIST_ITEM){
targetBody.appendListItem(element);
}
else if( type == DocumentApp.ElementType.HORIZONTAL_RULE) {
targetBody.appendHorizontalRule();
}
else if( type == DocumentApp.ElementType.PAGE_BREAK) {
targetBody.appendPageBreak();
}
}
var-activeDocID=DocumentApp.getActiveDocument().getId();
var targetBody=DocumentApp.openById(activeDocID.getBody();
对于(i=0;i
我得到了一个错误:
“服务不可用:文件”(השרתלאזן:ססם)
如何解决此问题?抛出错误时,
元素
的值是多少?元素是带有图像的ListItem。如果我从源代码中删除图像,它就正常工作了。你能分享一下它的价值吗?此处没有足够的信息来了解引发此错误的原因,因为可能有许多不同的原因。如何查看其值?请将其放入日志中,可以是Logger.log()
或console.log()
并在常规日志或stackdriver日志中查看。抛出错误时,元素的值是多少?元素是带有图像的ListItem。如果我从源代码中删除图像,它就正常工作了。你能分享一下它的价值吗?此处没有足够的信息来了解引发此错误的原因,因为可能有许多不同的原因。如何查看其值?将其放入日志中,可以是Logger.log()
或console.log()
,然后在常规日志或stackdriver日志中查看。