Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/api/enum/WdBuiltinStyle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ Specifies a built-in Microsoft Word style.
Example::

from docx import Document
from docx.enum.style import WD_STYLE

document = Document()
styles = document.styles
style = styles[WD_STYLE.BODY_TEXT]
style = styles["Body Text"]

A built-in style must be defined in the document before it can be looked up.
Style lookup uses the style's English UI name, e.g. ``"Body Text"``; a
``WD_STYLE`` member like ``WD_STYLE.BODY_TEXT`` is not a style lookup key.

----

Expand Down
7 changes: 5 additions & 2 deletions src/docx/enum/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ class WD_BUILTIN_STYLE(BaseEnum):
Example::

from docx import Document
from docx.enum.style import WD_STYLE

document = Document()
styles = document.styles
style = styles[WD_STYLE.BODY_TEXT]
style = styles["Body Text"]

A built-in style must be defined in the document before it can be looked
up. Style lookup uses the style's English UI name, e.g. ``"Body Text"``;
a ``WD_STYLE`` member like ``WD_STYLE.BODY_TEXT`` is not a style lookup
key.

MS API name: `WdBuiltinStyle`

Expand Down