`a:bodyPr` custom element class.
| 199 | |
| 200 | |
| 201 | class CT_TextBodyProperties(BaseOxmlElement): |
| 202 | """`a:bodyPr` custom element class.""" |
| 203 | |
| 204 | _add_noAutofit: Callable[[], BaseOxmlElement] |
| 205 | _add_normAutofit: Callable[[], CT_TextNormalAutofit] |
| 206 | _add_spAutoFit: Callable[[], BaseOxmlElement] |
| 207 | _remove_eg_textAutoFit: Callable[[], None] |
| 208 | |
| 209 | noAutofit: BaseOxmlElement | None |
| 210 | normAutofit: CT_TextNormalAutofit | None |
| 211 | spAutoFit: BaseOxmlElement | None |
| 212 | |
| 213 | eg_textAutoFit = ZeroOrOneChoice( |
| 214 | (Choice("a:noAutofit"), Choice("a:normAutofit"), Choice("a:spAutoFit")), |
| 215 | successors=("a:scene3d", "a:sp3d", "a:flatTx", "a:extLst"), |
| 216 | ) |
| 217 | lIns: Length = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 218 | "lIns", ST_Coordinate32, default=Emu(91440) |
| 219 | ) |
| 220 | tIns: Length = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 221 | "tIns", ST_Coordinate32, default=Emu(45720) |
| 222 | ) |
| 223 | rIns: Length = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 224 | "rIns", ST_Coordinate32, default=Emu(91440) |
| 225 | ) |
| 226 | bIns: Length = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 227 | "bIns", ST_Coordinate32, default=Emu(45720) |
| 228 | ) |
| 229 | anchor: MSO_VERTICAL_ANCHOR | None = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 230 | "anchor", MSO_VERTICAL_ANCHOR |
| 231 | ) |
| 232 | wrap: str | None = OptionalAttribute( # pyright: ignore[reportAssignmentType] |
| 233 | "wrap", ST_TextWrappingType |
| 234 | ) |
| 235 | |
| 236 | @property |
| 237 | def autofit(self): |
| 238 | """The autofit setting for the text frame, a member of the `MSO_AUTO_SIZE` enumeration.""" |
| 239 | if self.noAutofit is not None: |
| 240 | return MSO_AUTO_SIZE.NONE |
| 241 | if self.normAutofit is not None: |
| 242 | return MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE |
| 243 | if self.spAutoFit is not None: |
| 244 | return MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT |
| 245 | return None |
| 246 | |
| 247 | @autofit.setter |
| 248 | def autofit(self, value: MSO_AUTO_SIZE | None): |
| 249 | if value is not None and value not in MSO_AUTO_SIZE: |
| 250 | raise ValueError( |
| 251 | f"only None or a member of the MSO_AUTO_SIZE enumeration can be assigned to" |
| 252 | f" CT_TextBodyProperties.autofit, got {value}" |
| 253 | ) |
| 254 | self._remove_eg_textAutoFit() |
| 255 | if value == MSO_AUTO_SIZE.NONE: |
| 256 | self._add_noAutofit() |
| 257 | elif value == MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE: |
| 258 | self._add_normAutofit() |
nothing calls this directly
no test coverage detected
searching dependent graphs…