You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Superscript text doesn't get the superscript attribute #1606
for that run, using Release 1.1.0+dfsg-2 of Ubuntu 24.04.4 LTS, does not yield True, which it should.
So this a bug, or maybe a missing attribute of the "Run" object, e.g. "run.superscript" which doesn't exist, like "run.italic" or "run.bold" which do exist.
While there is the italic attribute of the run in the library which does work, there is none for the smallCaps attribute (e.g. run.small_caps or so) of the run, and the small_caps attribute also doesn't show up as True in the run's style's font object either.
Bug or omission, but a missing functionality anyway, which looks quite simple to add due to having the same structure as the italics tag.
run.style.font inspects the character style's font properties. The <w:rPr> elements in the examples are direct formatting on the run, so they are read through run.font instead.
I tested minimal runs containing the two XML fragments with python-docx 1.2.0 / Python 3.13.5: the corresponding run.font property is True, while the same property on run.style.font is None. Both direct-format values also remain True after saving to a BytesIO and reopening the document.
This addresses the explicit formatting in these examples; it is not a general computed-style/inheritance resolver.
Investigation and verification performed with OpenAI Codex at the account owner's request.
Activity
peerDE commentedon Sep 8, 2026
Same thing with small_caps which also can't be read from the run.
The run properties element looks like this:
While there is the italic attribute of the run in the library which does work, there is none for the smallCaps attribute (e.g. run.small_caps or so) of the run, and the small_caps attribute also doesn't show up as True in the run's style's font object either.
Bug or omission, but a missing functionality anyway, which looks quite simple to add due to having the same structure as the italics tag.
saitakarcesme commentedon Sep 22, 2026
Both properties are available on
run.font:run.style.fontinspects the character style's font properties. The<w:rPr>elements in the examples are direct formatting on the run, so they are read throughrun.fontinstead.I tested minimal runs containing the two XML fragments with python-docx 1.2.0 / Python 3.13.5: the corresponding
run.fontproperty isTrue, while the same property onrun.style.fontisNone. Both direct-format values also remainTrueafter saving to aBytesIOand reopening the document.This addresses the explicit formatting in these examples; it is not a general computed-style/inheritance resolver.
Investigation and verification performed with OpenAI Codex at the account owner's request.
peerDE commentedon Sep 22, 2026
Thus it works.
Thank you for helping me over my blind spot!