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

426 views Asked by At

My goal:

  • I want to create a new table inside the Google Slides for the specified 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

Known limitations:

  • slides api documentation states that minimum column width can be 406400 (EMU) or 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"?
1

There are 1 answers

1
Rafa Guillermo On

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. Much like in the UI, you can draw multiple lines and 'stitch' them together with location data.

From the documentation:

Shape

A PageElement kind representing a generic shape that does not have a more specific classification.

Example:

enter image description here

References: