MCPcopy Create free account
hub / github.com/scanny/python-pptx / CT_TextBodyProperties

Class CT_TextBodyProperties

src/pptx/oxml/text.py:201–260  ·  view source on GitHub ↗

`a:bodyPr` custom element class.

Source from the content-addressed store, hash-verified

199
200
201class 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()

Callers

nothing calls this directly

Calls 4

ZeroOrOneChoiceClass · 0.90
ChoiceClass · 0.90
OptionalAttributeClass · 0.90
EmuClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…