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

Method style

src/docx/table.py:120–133  ·  view source on GitHub ↗

|_TableStyle| object representing the style applied to this table. Read/write. The default table style for the document (often `Normal Table`) is returned if the table has no directly-applied style. Assigning |None| to this property removes any directly-applied table style c

(self)

Source from the content-addressed store, hash-verified

118
119 @property
120 def style(self) -> _TableStyle | None:
121 """|_TableStyle| object representing the style applied to this table.
122
123 Read/write. The default table style for the document (often `Normal Table`) is
124 returned if the table has no directly-applied style. Assigning |None| to this
125 property removes any directly-applied table style causing it to inherit the
126 default table style of the document.
127
128 Note that the style name of a table style differs slightly from that displayed
129 in the user interface; a hyphen, if it appears, must be removed. For example,
130 `Light Shading - Accent 1` becomes `Light Shading Accent 1`.
131 """
132 style_id = self._tbl.tblStyle_val
133 return cast("_TableStyle | None", self.part.get_style(style_id, WD_STYLE_TYPE.TABLE))
134
135 @style.setter
136 def style(self, style_or_name: _TableStyle | str | None):

Callers

nothing calls this directly

Calls 2

get_styleMethod · 0.45
get_style_idMethod · 0.45

Tested by

no test coverage detected