MCPcopy Create free account
hub / github.com/scanny/python-pptx / insert_table

Method insert_table

src/pptx/shapes/placeholder.py:381–395  ·  view source on GitHub ↗

Return |PlaceholderGraphicFrame| object containing a `rows` by `cols` table. The position and width of the table are those of the placeholder and its height is proportional to the number of rows. A |PlaceholderGraphicFrame| object has all the properties and methods of a |Gra

(self, rows, cols)

Source from the content-addressed store, hash-verified

379 """Placeholder shape that can only accept a table."""
380
381 def insert_table(self, rows, cols):
382 """Return |PlaceholderGraphicFrame| object containing a `rows` by `cols` table.
383
384 The position and width of the table are those of the placeholder and its height
385 is proportional to the number of rows. A |PlaceholderGraphicFrame| object has
386 all the properties and methods of a |GraphicFrame| shape except that the value
387 of its :attr:`~._BaseSlidePlaceholder.shape_type` property is unconditionally
388 `MSO_SHAPE_TYPE.PLACEHOLDER`. Note that the return value is not the new table
389 but rather *contains* the new table. The table can be accessed using the
390 :attr:`~.PlaceholderGraphicFrame.table` property of the returned
391 |PlaceholderGraphicFrame| object.
392 """
393 graphicFrame = self._new_placeholder_table(rows, cols)
394 self._replace_placeholder_with(graphicFrame)
395 return PlaceholderGraphicFrame(graphicFrame, self._parent)
396
397 def _new_placeholder_table(self, rows, cols):
398 """

Calls 3

Tested by 1