Table objects¶A Table object is added to a slide using the
add_table() method on SlideShapes.
A DrawingML table object.
Not intended to be constructed directly, use
Slide.shapes.add_table() to add a table to a slide.
Return cell at row_idx, col_idx.
Return value is an instance of _Cell. row_idx and col_idx are
zero-based, e.g. cell(0, 0) is the top, left cell in the table.
_ColumnCollection instance for this table.
Provides access to _Column objects representing the table’s columns. _Column
objects are accessed using list notation, e.g. col = tbl.columns[0].
Read/write boolean property which, when true, indicates the first column should be formatted differently, as for a side-heading column at the far left of the table.
Read/write boolean property which, when true, indicates the first row should be formatted differently, e.g. for column headings.
Read/write boolean property which, when true, indicates the rows of the table should appear with alternating shading.
Generate _Cell object for each cell in this table.
Each grid cell is generated in left-to-right, top-to-bottom order.
Read/write boolean property which, when true, indicates the last column should be formatted differently, as for a row totals column at the far right of the table.
Read/write boolean property which, when true, indicates the last row should be formatted differently, as for a totals row at the bottom of the table.
_RowCollection instance for this table.
Provides access to _Row objects representing the table’s rows. _Row objects
are accessed using list notation, e.g. col = tbl.rows[0].
Read/write boolean property which, when true, indicates the columns of the table should appear with alternating shading.
_Column objects¶_Row objects¶_Cell objects¶A _Cell object represents a single table cell at a particular row/column
location in the table. _Cell objects are not constructed directly. A
reference to a _Cell object is obtained using the Table.cell() method,
specifying the cell’s row/column location. A cell object can also be obtained
using the _Row.cells collection.
Table cell
FillFormat instance for this cell, providing access to fill
properties such as foreground color.
True if this cell is the top-left grid cell in a merged cell.
True if this cell is spanned by a merge-origin cell.
A merge-origin cell “spans” the other grid cells in its merge range, consuming their area and “shadowing” the spanned grid cells.
Note this value is False for a merge-origin cell. A merge-origin
cell spans other grid cells, but is not itself a spanned cell.
Read/write integer value of left margin of cell as a Length value
object. If assigned None, the default value is used, 0.1 inches for
left and right margins and 0.05 inches for top and bottom.
Right margin of cell.
Top margin of cell.
Bottom margin of cell.
Create merged cell from this cell to other_cell.
This cell and other_cell specify opposite corners of the merged cell range. Either diagonal of the cell region may be specified in either order, e.g. self=bottom-right, other_cell=top-left, etc.
Raises ValueError if the specified range already contains merged
cells anywhere within its extents or if other_cell is not in the
same table as self.
int count of rows spanned by this cell.
The value of this property may be misleading (often 1) on cells where
.is_merge_origin is not True, since only a merge-origin cell
contains complete span information. This property is only intended
for use on cells known to be a merge origin by testing
.is_merge_origin.
int count of columns spanned by this cell.
The value of this property may be misleading (often 1) on cells where
.is_merge_origin is not True, since only a merge-origin cell
contains complete span information. This property is only intended
for use on cells known to be a merge origin by testing
.is_merge_origin.
Remove merge from this (merge-origin) cell.
The merged cell represented by this object will be “unmerged”, yielding a separate unmerged cell for each grid cell previously spanned by this merge.
Raises ValueError when this cell is not a merge-origin cell. Test
with .is_merge_origin before calling.
Unicode (str in Python 3) representation of cell contents.
The returned string will contain a newline character ("\n") separating each
paragraph and a vertical-tab ("\v") character for each line break (soft
carriage return) in the cell’s text.
Assignment to text replaces all text currently contained in the cell. A
newline character ("\n") in the assigned text causes a new paragraph to be
started. A vertical-tab ("\v") character in the assigned text causes
a line-break (soft carriage-return) to be inserted. (The vertical-tab character
appears in clipboard text copied from PowerPoint as its encoding of
line-breaks.)
Either bytes (Python 2 str) or unicode (Python 3 str) can be assigned. Bytes can be 7-bit ASCII or UTF-8 encoded 8-bit bytes. Bytes values are converted to unicode assuming UTF-8 encoding (which correctly decodes ASCII).
Vertical alignment of this cell.
This value is a member of the MSO_VERTICAL_ANCHOR enumeration or
None. A value of None indicates the cell has no explicitly
applied vertical anchor setting and its effective value is inherited
from its style-hierarchy ancestors.
Assigning None to this property causes any explicitly applied
vertical anchor setting to be cleared and inheritance of its
effective value to be restored.