_Cell
paper-pptx 0.2.0 API reference
Table cell
_Cell(tc: CT_TableCell, parent: ProvidesPart)Attributes
fill
attributefillFillFormatFillFormat instance for this cell.
Provides access to fill properties such as foreground color.
is_merge_origin
attributeis_merge_originboolTrue if this cell is the top-left grid cell in a merged cell.
is_spanned
attributeis_spannedboolTrue 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.
margin_bottom
attributemargin_bottomLengthBottom margin of cell.
margin_left
attributemargin_leftLengthLeft margin of cells.
Read/write. If assigned None, the default value is used, 0.1 inches for left and right
margins and 0.05 inches for top and bottom.
margin_right
attributemargin_rightLengthRight margin of cell.
margin_top
attributemargin_topLengthTop margin of cell.
part
attributepartXmlPartThe package part containing this object.
span_height
attributespan_heightintint 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.
span_width
attributespan_widthintint 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.
text
attributetextstrTextual content of cell as a single string.
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.)
text_frame
attributetext_frameTextFrameTextFrame containing the text that appears in the cell.
vertical_anchor
attributevertical_anchorMSO_VERTICAL_ANCHOR | NoneVertical alignment of this cell.
This value is a member of the :ref:MsoVerticalAnchor 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.
Functions
extend_merge
funcextend_merge(other_cell: _Cell) -> NoneExtend this merge-origin cell through other_cell atomically.
paper-pptx addition. other_cell is the requested new lower-right corner. The existing
rectangular merge may grow rightward, downward, or in both directions. Only paragraphs
from newly absorbed cells move to this origin, in row-major order; existing merged content
is not moved again.
The existing merge must have canonical continuation topology and every newly absorbed cell
must be unmerged. Malformed or conflicting merge structure raises
UnsupportedStructureError without mutation. A stale origin or target raises
TargetNotFoundError. Passing a non-cell, a cell from another table, a non-origin receiver,
or a corner that would shrink or move the merge raises ValueError.
paramother_cell_CellReturns
Nonemerge
funcmerge(other_cell: _Cell) -> NoneCreate 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.
paramother_cell_CellReturns
Nonesplit
funcsplit() -> NoneRemove 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.
Returns
None