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

Method get_style_id

src/docx/styles/styles.py:85–98  ·  view source on GitHub ↗

Return the id of the style corresponding to `style_or_name`, or |None| if `style_or_name` is |None|. If `style_or_name` is not a style object, the style is looked up using `style_or_name` as a style name, raising |ValueError| if no style with that name is defined. Ra

(self, style_or_name, style_type)

Source from the content-addressed store, hash-verified

83 return self._get_by_id(style_id, style_type)
84
85 def get_style_id(self, style_or_name, style_type):
86 """Return the id of the style corresponding to `style_or_name`, or |None| if
87 `style_or_name` is |None|.
88
89 If `style_or_name` is not a style object, the style is looked up using
90 `style_or_name` as a style name, raising |ValueError| if no style with that name
91 is defined. Raises |ValueError| if the target style is not of `style_type`.
92 """
93 if style_or_name is None:
94 return None
95 elif isinstance(style_or_name, BaseStyle):
96 return self._get_style_id_from_style(style_or_name, style_type)
97 else:
98 return self._get_style_id_from_name(style_or_name, style_type)
99
100 @property
101 def latent_styles(self):

Callers 6

styleMethod · 0.45
styleMethod · 0.45
styleMethod · 0.45

Calls 2