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

Method _get_style_id_from_name

src/docx/styles/styles.py:118–125  ·  view source on GitHub ↗

Return the id of the style of `style_type` corresponding to `style_name`. Returns |None| if that style is the default style for `style_type`. Raises |ValueError| if the named style is not found in the document or does not match `style_type`.

(self, style_name: str, style_type: WD_STYLE_TYPE)

Source from the content-addressed store, hash-verified

116 return StyleFactory(style)
117
118 def _get_style_id_from_name(self, style_name: str, style_type: WD_STYLE_TYPE) -> str | None:
119 """Return the id of the style of `style_type` corresponding to `style_name`.
120
121 Returns |None| if that style is the default style for `style_type`. Raises
122 |ValueError| if the named style is not found in the document or does not match
123 `style_type`.
124 """
125 return self._get_style_id_from_style(self[style_name], style_type)
126
127 def _get_style_id_from_style(self, style: BaseStyle, style_type: WD_STYLE_TYPE) -> str | None:
128 """Id of `style`, or |None| if it is the default style of `style_type`.

Callers 2

get_style_idMethod · 0.95

Calls 1