简体   繁体   English

Python Google Slides API - 调整表格宽度和高度以适合页面内部

[英]Python Google Slides API - Adjust table width and height to fit inside the page

My goal:我的目标:

  • I want to create a new table inside the Google Slides for the specified page_id我想在 Google 幻灯片中为指定的 page_id 创建一个新表
  • Adjust the table column width and row height so the whole table would fit in a single page.调整表格列宽和行高,使整个表格适合单个页面。
  • I want to achieve above using python我想使用python实现以上目标

Known limitations:已知限制:

  • slides api documentation states that minimum column width can be 406400 (EMU) or 32 PT. slides api 文档指出最小列宽可以是 406400 (EMU) 或 32 PT。 These are too big for the table I need.这些对于我需要的桌子来说太大了。
  • Sending a request with values lower than above, will make no change to a table in the presentation.发送值低于上述值的请求不会更改演示文稿中的表格。

My questions:我的问题:

  1. Is there a way to undermine the column width min value?有没有办法破坏列宽最小值?
  2. How can I create a table that maximises the page "real estate"?如何创建一个最大化页面“不动产”的表格?

Thanks谢谢

Short Answers:简短的答案:

  1. Is there a way to undermine the column width min value?有没有办法破坏列宽最小值?
    • No. but you can use line shapes to draw a table instead with closer spacing.不可以,但您可以使用线条形状来绘制表格,而不是使用更近的间距。
  2. How can I create a table that maximises the page "real estate"?如何创建一个最大化页面“不动产”的表格?
    • Also by using line shapes instead of a table.也可以使用线条形状而不是表格。

More Information:更多信息:

You can't undermine the set-out minimum limits of the table settings, this is done by design in Slides.您不能破坏表格设置的最低限度,这是在幻灯片中设计的。

As a workaround, however, you can 'draw' your own tables out of line Shapes.但是,作为一种解决方法,您可以“绘制”您自己的表格,使其脱离线形。 It's a bit of an ugly workaround, but certainly doable.这是一个有点丑陋的解决方法,但肯定是可行的。

There exists a PageElement of Shape type which you can create to simulate drawing a table.存在一个Shape类型的PageElement ,您可以创建它来模拟绘制表格。 Much like in the UI, you can draw multiple lines and 'stitch' them together with location data.就像在 UI 中一样,您可以绘制多条线并将它们与位置数据“缝合”在一起。

From the documentation :文档

Shape形状

A PageElement kind representing a generic shape that does not have a more specific classification.表示没有更具体分类的通用形状的PageElement种类。

Example:例子:

在此处输入图片说明

I hope this is helpful to you!我希望这对你有帮助!

References:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM