CT_Tbl
paper-docx 0.2.0 API reference
<w:tbl> element.
Attributes
add_tr
attributeadd_trCallable[[], CT_Row]bidiVisual_val
attributebidiVisual_valbool | NoneValue 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_countThe number of grid columns in this table.
tblGrid
attributetblGridCT_TblGrid= OneAndOnlyOne('w:tblGrid')tblPr
attributetblPrCT_TblPr= OneAndOnlyOne('w:tblPr')tblStyle_val
attributetblStyle_valstr | Nonew: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
attributexmlstrXML 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 | NoneFirst child with tag in tagnames, or None if not found.
paramtagnamesstr= ()Returns
lxml.etree._Element | Noneinsert_element_before
funcinsert_element_before(elm: ElementBase, *tagnames: str)paramelmElementBaseparamtagnamesstr= ()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_TblReturn a new w:tbl element having rows rows and cols columns.
width is distributed evenly between the columns.
paramrowsintparamcolsintparamwidthLengthReturns
docx.oxml.table.CT_Tblremove_all
funcremove_all(*tagnames: str) -> NoneRemove child elements with tagname (e.g. "a:p") in tagnames.
paramtagnamesstr= ()Returns
Nonexpath
funcxpath(xpath_str: str) -> AnyOverride of lxml _Element.xpath() method.
Provides standard Open XML namespace mapping (nsmap) in centralized location.
paramxpath_strstrReturns
typing.Any