MCPcopy Create free account
hub / github.com/python-openxml/python-docx / style

Method style

src/docx/text/run.py:189–198  ·  view source on GitHub ↗

Read/write. A |CharacterStyle| object representing the character style applied to this run. The default character style for the document (often `Default Character Font`) is returned if the run has no directly-applied character style. Setting this property to |None| r

(self)

Source from the content-addressed store, hash-verified

187
188 @property
189 def style(self) -> CharacterStyle:
190 """Read/write.
191
192 A |CharacterStyle| object representing the character style applied to this run.
193 The default character style for the document (often `Default Character Font`) is
194 returned if the run has no directly-applied character style. Setting this
195 property to |None| removes any directly-applied character style.
196 """
197 style_id = self._r.style
198 return cast(CharacterStyle, self.part.get_style(style_id, WD_STYLE_TYPE.CHARACTER))
199
200 @style.setter
201 def style(self, style_or_name: str | CharacterStyle | None):

Callers

nothing calls this directly

Calls 2

get_styleMethod · 0.45
get_style_idMethod · 0.45

Tested by

no test coverage detected