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

Class CT_TblWidth

src/docx/oxml/table.py:399–418  ·  view source on GitHub ↗

Used for `w:tblW` and `w:tcW` and others, specifies a table-related width.

Source from the content-addressed store, hash-verified

397
398
399class CT_TblWidth(BaseOxmlElement):
400 """Used for `w:tblW` and `w:tcW` and others, specifies a table-related width."""
401
402 # the type for `w` attr is actually ST_MeasurementOrPercent, but using
403 # XsdInt for now because only dxa (twips) values are being used. It's not
404 # entirely clear what the semantics are for other values like -01.4mm
405 w: int = RequiredAttribute("w:w", XsdInt) # pyright: ignore[reportAssignmentType]
406 type = RequiredAttribute("w:type", ST_TblWidth)
407
408 @property
409 def width(self) -> Length | None:
410 """EMU length indicated by the combined `w:w` and `w:type` attrs."""
411 if self.type != "dxa":
412 return None
413 return Twips(self.w)
414
415 @width.setter
416 def width(self, value: Length):
417 self.type = "dxa"
418 self.w = Emu(value).twips
419
420
421class CT_Tc(BaseOxmlElement):

Callers

nothing calls this directly

Calls 1

RequiredAttributeClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…