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

Class CT_Style

src/docx/oxml/styles.py:92–269  ·  view source on GitHub ↗

A `` `` element, representing a style definition.

Source from the content-addressed store, hash-verified

90
91
92class CT_Style(BaseOxmlElement):
93 """A ``<w:style>`` element, representing a style definition."""
94
95 _tag_seq = (
96 "w:name",
97 "w:aliases",
98 "w:basedOn",
99 "w:next",
100 "w:link",
101 "w:autoRedefine",
102 "w:hidden",
103 "w:uiPriority",
104 "w:semiHidden",
105 "w:unhideWhenUsed",
106 "w:qFormat",
107 "w:locked",
108 "w:personal",
109 "w:personalCompose",
110 "w:personalReply",
111 "w:rsid",
112 "w:pPr",
113 "w:rPr",
114 "w:tblPr",
115 "w:trPr",
116 "w:tcPr",
117 "w:tblStylePr",
118 )
119 name = ZeroOrOne("w:name", successors=_tag_seq[1:])
120 basedOn = ZeroOrOne("w:basedOn", successors=_tag_seq[3:])
121 next = ZeroOrOne("w:next", successors=_tag_seq[4:])
122 uiPriority = ZeroOrOne("w:uiPriority", successors=_tag_seq[8:])
123 semiHidden = ZeroOrOne("w:semiHidden", successors=_tag_seq[9:])
124 unhideWhenUsed = ZeroOrOne("w:unhideWhenUsed", successors=_tag_seq[10:])
125 qFormat = ZeroOrOne("w:qFormat", successors=_tag_seq[11:])
126 locked = ZeroOrOne("w:locked", successors=_tag_seq[12:])
127 pPr = ZeroOrOne("w:pPr", successors=_tag_seq[17:])
128 rPr = ZeroOrOne("w:rPr", successors=_tag_seq[18:])
129 del _tag_seq
130
131 type: WD_STYLE_TYPE | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
132 "w:type", WD_STYLE_TYPE
133 )
134 styleId: str | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
135 "w:styleId", ST_String
136 )
137 default = OptionalAttribute("w:default", ST_OnOff)
138 customStyle = OptionalAttribute("w:customStyle", ST_OnOff)
139
140 @property
141 def basedOn_val(self):
142 """Value of `w:basedOn/@w:val` or |None| if not present."""
143 basedOn = self.basedOn
144 if basedOn is None:
145 return None
146 return basedOn.val
147
148 @basedOn_val.setter
149 def basedOn_val(self, value):

Callers

nothing calls this directly

Calls 2

ZeroOrOneClass · 0.90
OptionalAttributeClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…