Skip to content

Commit 3eb7d1e

Browse files
author
Steve Canny
committed
docs: add API documentation for latent styles
* also add API for Styles objects
1 parent f2213d0 commit 3eb7d1e

File tree

4 files changed

+42
-10
lines changed

4 files changed

+42
-10
lines changed

docs/api/style.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@ formatting consistency thoroughout a document and across related documents
1010
and allows formatting changes to be made globally by changing the definition
1111
in the appropriate style.
1212

13-
.. currentmodule:: docx.styles.style
13+
14+
|Styles| objects
15+
----------------
16+
17+
.. currentmodule:: docx.styles.styles
18+
19+
.. autoclass:: Styles()
20+
:members:
21+
:inherited-members:
22+
:exclude-members:
23+
get_by_id, get_style_id, part
1424

1525

1626
|BaseStyle| objects
1727
-------------------
1828

29+
.. currentmodule:: docx.styles.style
30+
1931
.. autoclass:: BaseStyle()
2032
:members:
2133
:inherited-members:
@@ -61,3 +73,25 @@ in the appropriate style.
6173

6274
.. autoclass:: _NumberingStyle()
6375
:members:
76+
77+
78+
|LatentStyles| objects
79+
----------------------
80+
81+
.. currentmodule:: docx.styles.latent
82+
83+
.. autoclass:: LatentStyles()
84+
:members:
85+
:inherited-members:
86+
:exclude-members:
87+
part
88+
89+
90+
|_LatentStyle| objects
91+
----------------------
92+
93+
.. autoclass:: _LatentStyle()
94+
:members:
95+
:inherited-members:
96+
:exclude-members:
97+
part

docs/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@
149149
150150
.. |str| replace:: :class:`.str`
151151
152-
.. |Style| replace:: :class:`.Style`
153-
154152
.. |Styles| replace:: :class:`.Styles`
155153
156154
.. |StylesPart| replace:: :class:`.StylesPart`

docs/user/styles-using.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ name::
3636
are accessed with the name exactly as it appears in the Word UI.
3737

3838
The |Styles| object is also iterable. By using the identification properties
39-
on |Style|, various subsets of the defined styles can be generated. For
39+
on |BaseStyle|, various subsets of the defined styles can be generated. For
4040
example, this code will produce a list of the defined paragraph styles::
4141

4242
>>> from docx.enum.style import WD_STYLE_TYPE
@@ -56,7 +56,7 @@ Apply a style
5656
-------------
5757

5858
The |Paragraph|, |Run|, and |Table| objects each have a :attr:`style`
59-
attribute. Assigning a |Style| object to this attribute applies that style::
59+
attribute. Assigning a style object to this attribute applies that style::
6060

6161
>>> document = Document()
6262
>>> paragraph = document.add_paragraph()
@@ -77,8 +77,8 @@ lookup for you::
7777
>>> paragraph.style.name
7878
'List Bullet'
7979

80-
A style can also be applied at creation time using either the |Style| object
81-
or its name::
80+
A style can also be applied at creation time using either the style object or
81+
its name::
8282

8383
>>> paragraph = document.add_paragraph(style='Body Text')
8484
>>> paragraph.style.name

docx/styles/styles.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
class Styles(ElementProxy):
1717
"""
18-
A collection of |Style| objects defined in a document. Supports
19-
``len()``, iteration, and dictionary-style access by style id and style
20-
UI name.
18+
A collection providing access to the styles defined in a document.
19+
Accessed using the :attr:`.Document.styles` property. Supports ``len()``,
20+
iteration, and dictionary-style access by style name.
2121
"""
2222

2323
__slots__ = ()

0 commit comments

Comments
 (0)