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

Method style

src/docx/text/paragraph.py:131–142  ·  view source on GitHub ↗

Read/Write. |_ParagraphStyle| object representing the style assigned to this paragraph. If no explicit style is assigned to this paragraph, its value is the default paragraph style for the document. A paragraph style name can be assigned in lieu of a paragraph style

(self)

Source from the content-addressed store, hash-verified

129
130 @property
131 def style(self) -> ParagraphStyle | None:
132 """Read/Write.
133
134 |_ParagraphStyle| object representing the style assigned to this paragraph. If
135 no explicit style is assigned to this paragraph, its value is the default
136 paragraph style for the document. A paragraph style name can be assigned in lieu
137 of a paragraph style object. Assigning |None| removes any applied style, making
138 its effective value the default paragraph style for the document.
139 """
140 style_id = self._p.style
141 style = self.part.get_style(style_id, WD_STYLE_TYPE.PARAGRAPH)
142 return cast(ParagraphStyle, style)
143
144 @style.setter
145 def style(self, style_or_name: str | ParagraphStyle | None):

Callers

nothing calls this directly

Calls 2

get_styleMethod · 0.45
get_style_idMethod · 0.45

Tested by

no test coverage detected