Paper Office
paper-pptxAPI referenceoxml.table

CT_TableCell

paper-pptx 0.2.0 API reference

a:tc custom element class

Attributes

anchor

attributeanchorMSO_VERTICAL_ANCHOR | None

String held in anchor attribute of a:tcPr child element of this a:tc element.

col_idx

attributecol_idxint

Offset of this cell's column in its table.

get_or_add_tcPr

attributeget_or_add_tcPrCallable[[], CT_TableCellProperties]

get_or_add_txBody

attributeget_or_add_txBodyCallable[[], CT_TextBody]

gridSpan

attributegridSpanint
= OptionalAttribute('gridSpan', XsdInt, default=1)

hMerge

attributehMergebool
= OptionalAttribute('hMerge', XsdBoolean, default=False)

is_merge_origin

attributeis_merge_originbool

True if cell is top-left in merged cell range.

is_spanned

attributeis_spannedbool

True if cell is in merged cell range but not merge origin cell.

marB

attributemarBLength

Bottom margin value represented in marB attribute.

marL

attributemarLLength

Left margin value represented in marL attribute.

marR

attributemarRLength

Right margin value represented in marR attribute.

marT

attributemarTLength

Top margin for this cell.

This value is stored in the marT attribute of the a:tcPr child element of this a:tc.

Read/write. If the attribute is not present, the default value 45720 (0.05 inches) is returned for top and bottom; 91440 (0.10 inches) is the default for left and right. Assigning None to any marX property clears that attribute from the element, effectively setting it to the default value.

rowSpan

attributerowSpanint
= OptionalAttribute('rowSpan', XsdInt, default=1)

row_idx

attributerow_idxint

Offset of this cell's row in its table.

tbl

attributetblCT_Table

Table element this cell belongs to.

tcPr

attributetcPrCT_TableCellProperties | None
= ZeroOrOne('a:tcPr', successors=(_tag_seq[2:]))

text

attributetextstr

str text contained in cell

txBody

attributetxBodyCT_TextBody | None
= ZeroOrOne('a:txBody', successors=(_tag_seq[1:]))

vMerge

attributevMergebool
= OptionalAttribute('vMerge', XsdBoolean, default=False)

xml

attributexmlstr

XML string for this element, suitable for testing purposes.

Pretty printed for readability and without an XML declaration at the top.

Functions

append_ps_from

funcappend_ps_from(spanned_tc: CT_TableCell)

Append a:p elements taken from spanned_tc.

Any non-empty paragraph elements in spanned_tc are removed and appended to the text-frame of this cell. If spanned_tc is left with no content after this process, a single empty a:p element is added to ensure the cell is compliant with the spec.

paramspanned_tcCT_TableCell

first_child_found_in

funcfirst_child_found_in(*tagnames: str) -> _Element | None

First child with tag in tagnames, or None if not found.

paramtagnamesstr
= ()

Returns

lxml.etree._Element | None

insert_element_before

funcinsert_element_before(elm: ElementBase, *tagnames: str)
paramelmElementBase
paramtagnamesstr
= ()

new

funcnew() -> CT_TableCell

Return a new a:tc element subtree.

Returns

pptx.oxml.table.CT_TableCell

remove_all

funcremove_all(*tagnames: str) -> None

Remove child elements with tagname (e.g. "a:p") in tagnames.

paramtagnamesstr
= ()

Returns

None

xpath

funcxpath(xpath_str: str) -> Any

Override of lxml _Element.xpath() method.

Provides standard Open XML namespace mapping (nsmap) in centralized location.

paramxpath_strstr

Returns

typing.Any

On this page