|
6 | 6 |
|
7 | 7 | from ...enum.text import WD_UNDERLINE |
8 | 8 | from ..ns import qn |
9 | | -from ..simpletypes import ST_BrClear, ST_BrType, ST_HpsMeasure, ST_String |
| 9 | +from ..simpletypes import ( |
| 10 | + ST_BrClear, ST_BrType, ST_HpsMeasure, ST_String, ST_VerticalAlignRun |
| 11 | +) |
10 | 12 | from ..xmlchemy import ( |
11 | 13 | BaseOxmlElement, OptionalAttribute, RequiredAttribute, ZeroOrMore, |
12 | 14 | ZeroOrOne |
@@ -156,6 +158,7 @@ class CT_RPr(BaseOxmlElement): |
156 | 158 | webHidden = ZeroOrOne('w:webHidden', successors=_tag_seq[18:]) |
157 | 159 | sz = ZeroOrOne('w:sz', successors=_tag_seq[24:]) |
158 | 160 | u = ZeroOrOne('w:u', successors=_tag_seq[27:]) |
| 161 | + vertAlign = ZeroOrOne('w:vertAlign', successors=_tag_seq[32:]) |
159 | 162 | rtl = ZeroOrOne('w:rtl', successors=_tag_seq[33:]) |
160 | 163 | cs = ZeroOrOne('w:cs', successors=_tag_seq[34:]) |
161 | 164 | specVanish = ZeroOrOne('w:specVanish', successors=_tag_seq[38:]) |
@@ -225,6 +228,20 @@ def style(self, style): |
225 | 228 | else: |
226 | 229 | self.rStyle.val = style |
227 | 230 |
|
| 231 | + @property |
| 232 | + def subscript(self): |
| 233 | + """ |
| 234 | + |True| if `w:vertAlign/@w:val` is 'subscript'. |False| if |
| 235 | + `w:vertAlign/@w:val` contains any other value. |None| if |
| 236 | + `w:vertAlign` is not present. |
| 237 | + """ |
| 238 | + vertAlign = self.vertAlign |
| 239 | + if vertAlign is None: |
| 240 | + return None |
| 241 | + if vertAlign.val == ST_VerticalAlignRun.SUBSCRIPT: |
| 242 | + return True |
| 243 | + return False |
| 244 | + |
228 | 245 | @property |
229 | 246 | def sz_val(self): |
230 | 247 | """ |
@@ -314,6 +331,13 @@ def val(self, value): |
314 | 331 | self.set(qn('w:val'), val) |
315 | 332 |
|
316 | 333 |
|
| 334 | +class CT_VerticalAlignRun(BaseOxmlElement): |
| 335 | + """ |
| 336 | + ``<w:vertAlign>`` element, specifying subscript or superscript. |
| 337 | + """ |
| 338 | + val = RequiredAttribute('w:val', ST_VerticalAlignRun) |
| 339 | + |
| 340 | + |
317 | 341 | class _RunContentAppender(object): |
318 | 342 | """ |
319 | 343 | Service object that knows how to translate a Python string into run |
|
0 commit comments