MCPcopy Index your code
hub / github.com/python-openxml/python-docx / _tbl_xml

Method _tbl_xml

src/docx/oxml/table.py:220–233  ·  view source on GitHub ↗
(cls, rows: int, cols: int, width: Length)

Source from the content-addressed store, hash-verified

218
219 @classmethod
220 def _tbl_xml(cls, rows: int, cols: int, width: Length) -> str:
221 col_width = Emu(width // cols) if cols > 0 else Emu(0)
222 return (
223 f"<w:tbl {nsdecls('w')}>\n"
224 f" <w:tblPr>\n"
225 f' <w:tblW w:type="auto" w:w="0"/>\n'
226 f' <w:tblLook w:firstColumn="1" w:firstRow="1"\n'
227 f' w:lastColumn="0" w:lastRow="0" w:noHBand="0"\n'
228 f' w:noVBand="1" w:val="04A0"/>\n'
229 f" </w:tblPr>\n"
230 f"{cls._tblGrid_xml(cols, col_width)}"
231 f"{cls._trs_xml(rows, cols, col_width)}"
232 f"</w:tbl>\n"
233 )
234
235 @classmethod
236 def _tblGrid_xml(cls, col_count: int, col_width: Length) -> str:

Callers 1

new_tblMethod · 0.80

Calls 4

EmuClass · 0.90
nsdeclsFunction · 0.90
_tblGrid_xmlMethod · 0.80
_trs_xmlMethod · 0.80

Tested by

no test coverage detected