如何在Google文档中获取textwrap图片 [英] How I can get the textwrap image in google doc

查看:98
本文介绍了如何在Google文档中获取textwrap图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于现在 回答,我可以用图像复制元素,但我发现了另外一件事 - 如果图像插入为'文本' - 然后复制完成。但是当我把它做成'文字包装'时,我根本找不到这个元素!
这是测试代码:

pre $ 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(); (var j = 0; j var subelement = element.getChild(j).copy($ j

$ b $ if(children> 0) );
var subtype = subelement.getType();
Logger.log('subelement'+ j +:+ subtype);
if(subtype == DocumentApp.ElementType.TEXT)Logger.log(subelement.getText());


$ b $ 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错误(检查如何处理这种类型的元素:+ type);



$ / code $ / pre

所以我可以找到textwrap图片?或者现在是不可能的?

解决方案

这是使用Google Apps脚本(现在)不可能的,并且是<超过2年的href =https://code.google.com/p/google-apps-script-issues/issues/detail?id=1529 =nofollow>改进请求现在。



与此同时,只有内嵌图片


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?

解决方案

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.

这篇关于如何在Google文档中获取textwrap图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆