Used for `w:tblW` and `w:tcW` and others, specifies a table-related width.
| 397 | |
| 398 | |
| 399 | class 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 | |
| 421 | class CT_Tc(BaseOxmlElement): |
nothing calls this directly
no test coverage detected
searching dependent graphs…