MCPcopy Index your code
hub / github.com/python-openxml/python-docx / get_style

Method get_style

src/docx/parts/document.py:71–77  ·  view source on GitHub ↗

Return the style in this document matching `style_id`. Returns the default style for `style_type` if `style_id` is |None| or does not match a defined style of `style_type`.

(self, style_id: str | None, style_type: WD_STYLE_TYPE)

Source from the content-addressed store, hash-verified

69 return self.related_parts[rId]
70
71 def get_style(self, style_id: str | None, style_type: WD_STYLE_TYPE) -> BaseStyle:
72 """Return the style in this document matching `style_id`.
73
74 Returns the default style for `style_type` if `style_id` is |None| or does not
75 match a defined style of `style_type`.
76 """
77 return self.styles.get_by_id(style_id, style_type)
78
79 def get_style_id(self, style_or_name, style_type):
80 """Return the style_id (|str|) of the style of `style_type` matching

Callers 1

Calls 1

get_by_idMethod · 0.45

Tested by 1