现在由于this回答,我可以复制带有图像的元素,但我发现了另外一件事 - 如果图像插入文字' - 然后复制完成。但是当我把它包起来时,我根本找不到这个元素! 这是测试代码:
function test_show_all_structure_of_doc() {
var final = 'final';
var doc = get_doc(working_directory, final);
var body = doc.getBody();
var elements = body.getNumChildren();
for( var i=0;i<elements;i++) {
var element = body.getChild(i).copy();
var type = element.getType();
if( type == DocumentApp.ElementType.PARAGRAPH ){
Logger.log('paragraph' + i);
var children = element.getNumChildren();
if (children >0) {
for (var j=0;j<children;j++) {
var subelement = element.getChild(j).copy();
var subtype = subelement.getType();
Logger.log('subelement ' + j + ":" + subtype);
if (subtype == DocumentApp.ElementType.TEXT) Logger.log(subelement.getText());
}
}
}
else if( type == DocumentApp.ElementType.TABLE ){
Logger.log('table');}
else if( type == DocumentApp.ElementType.LIST_ITEM ){
Logger.log('list item');}
else if( type == DocumentApp.ElementType.INLINE_IMAGE ){
Logger.log('inline image');}
else {
throw new Error("check what to do with this type of element : "+ type);
}
}
}
那么在哪里可以找到textwrap图像?或者现在不可能?