Paper Office
paper-docxAPI referenceoxml.table

CT_Tbl

paper-docx 0.2.0 API reference

<w:tbl> element.

Attributes

add_tr

attributeadd_trCallable[[], CT_Row]

bidiVisual_val

attributebidiVisual_valbool | None

Value of ./w:tblPr/w:bidiVisual/@w:val or None if not present.

Controls whether table cells are displayed right-to-left or left-to-right.

col_count

attributecol_count

The number of grid columns in this table.

tblGrid

attributetblGridCT_TblGrid
= OneAndOnlyOne('w:tblGrid')

tblPr

attributetblPrCT_TblPr
= OneAndOnlyOne('w:tblPr')

tblStyle_val

attributetblStyle_valstr | None

w:tblPr/w:tblStyle/@w:val (a table style id) or None if not present.

tr

attributetr
= ZeroOrMore('w:tr')

tr_lst

attributetr_lstlist[CT_Row]

xml

attributexmlstr

XML string for this element, suitable for testing purposes.

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

Functions

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
= ()

iter_tcs

funciter_tcs()

Generate each of the w:tc elements in this table, left to right and top to bottom.

Each cell in the first row is generated, followed by each cell in the second row, etc.

new_tbl

funcnew_tbl(rows: int, cols: int, width: Length) -> CT_Tbl

Return a new w:tbl element having rows rows and cols columns.

width is distributed evenly between the columns.

paramrowsint
paramcolsint
paramwidthLength

Returns

docx.oxml.table.CT_Tbl

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