检测定位图像的元素类型

时间:2018-12-28 20:35:47

标签: google-apps-script google-docs

我正在尝试浏览Google文档中的每个元素。定位图像时,我很难定位图像,因此可以使用我的应用脚本来处理它。

没有用于定位图像的元素类型,因此当我按元素分解doc元素时,我无法通过它。继承人在线图像检测器

if (itemType === DocumentApp.ElementType.INLINE_IMAGE) {
    returns true if inlineImage detected
}

反正有定位图像吗?例如:

if (itemType === DocumentApp.ElementType.POSITIONED_IMAGE) {
    returns true if PositionedImage detected
}

1 个答案:

答案 0 :(得分:0)

我能够使用段落/列表类中的getPositionedImages()方法。这将拉出锚定到段落/列表的图像列表。

所以我的代码最终看起来像

if( item.getPositionedImages() !== null){
     //Process Image
}