【问题标题】:Inserting an image inside a table cell in Google Docs API在 Google Docs API 的表格单元格中插入图像
【发布时间】:2022-10-20 17:39:35
【问题描述】:

是否可以使用 API 直接在 Google Docs 的单元格中插入图像?我只想将图像放在 1x2 表格单元格的第一列。我看过documentation**insertInlineImage** 说:The image must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Inline images cannot be inserted inside a footnote or equation.

如何在 Google Docs python 中执行此操作?

Image in a Table

【问题讨论】:

  • 在您的情况下,这些信息有用吗? github.com/tanaikech/gdoctableapppy
  • 谢谢!我不知道这个,我会检查一下。我还发现 GDoc 的 API 太难消化了。
  • 谢谢你的回复。是的。另外,我认为使用 Docs API 创建表格的文档可能有点复杂。因此,我创建了一个库,以便使用 Docs API 轻松创建表。如果这对您的情况没有用,我深表歉意。

标签: python google-docs-api


【解决方案1】:

这是可能的,您可以:

  1. 使用像https://github.com/tanaikech/gdoctableapppy 这样的库让事情变得更简单
  2. 自己写流程,流程如下:
    1. 在您希望图像位于表格内的位置插入占位符标记,例如{{myImage}}
    2. 对文档进行批量更新,您可以:
      1. 搜索此占位符标记并将其删除
      2. 在此标记所在的位置插入内嵌图像

        当前的一个限制是必须可以从公共 URL 访问图像(请参阅 docs),目前有一个 feature request/bug 也允许上传图像

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-11
    • 2022-06-11
    • 2017-09-25
    • 2013-06-03
    • 2011-12-05
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    相关资源
    最近更新 更多