0

Due to this answer now I can make copy of elements with images right, but I spotted one more thing - if image inserted as 'in text' - then copying is done well. But when I make it 'text wrap', I can't find this element at all! Here is the code of test:

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);
    }
  }
}

so where I can find textwrap image? Or it is impossible for now?

Rubén
  • 34,714
  • 9
  • 70
  • 166
Karen Fisher
  • 747
  • 1
  • 8
  • 25

1 Answers1

0

This is not possible using Google Apps Script (for now) and is the object of an enhancement request for more than 2 years now.

In the mean time, only inline image is supported.

Serge insas
  • 45,904
  • 7
  • 105
  • 131