Skip to content

Commit bae756e

Browse files
author
Steve Canny
committed
docs: document ParagraphFormat analysis
* fix gap in Length API docs * add leading dot to help Sphinx find classes * change some substitutions from code font to :class: reference for improved rendering
1 parent 42ed65d commit bae756e

File tree

13 files changed

+629
-386
lines changed

13 files changed

+629
-386
lines changed

docs/api/enum/WdLineSpacing.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _WdLineSpacing:
2+
3+
``WD_LINE_SPACING``
4+
===================
5+
6+
Specifies a line spacing format to be applied to a paragraph.
7+
8+
Example::
9+
10+
from docx.enum.text import WD_LINE_SPACING
11+
12+
paragraph = document.add_paragraph()
13+
paragraph.line_spacing_rule = WD_LINE_SPACING.EXACTLY
14+
15+
----
16+
17+
ONE_POINT_FIVE
18+
Space-and-a-half line spacing.
19+
20+
AT_LEAST
21+
Line spacing is always at least the specified amount. The amount is
22+
specified separately.
23+
24+
DOUBLE
25+
Double spaced.
26+
27+
EXACTLY
28+
Line spacing is exactly the specified amount. The amount is specified
29+
separately.
30+
31+
MULTIPLE
32+
Line spacing is specified as a multiple of line heights. Changing the font
33+
size will change the line spacing proportionately.
34+
35+
SINGLE
36+
Single spaced (default).

docs/api/enum/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ can be found here:
1010

1111
WdAlignParagraph
1212
WdBuiltinStyle
13+
WdLineSpacing
1314
WdOrientation
1415
WdSectionStart
1516
WdStyleType

docs/api/shared.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,11 @@ allowing values to be expressed in the units most appropriate to the context.
3535
.. autoclass:: Mm
3636
:members:
3737

38+
.. autoclass:: Pt
39+
:members:
40+
41+
.. autoclass:: Twips
42+
:members:
43+
3844
.. autoclass:: Emu
3945
:members:

docs/api/text.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ Text-related objects
1414
:members:
1515

1616

17+
|ParagraphFormat| objects
18+
-------------------------
19+
20+
.. currentmodule:: docx.text.paragraph
21+
22+
.. autoclass:: ParagraphFormat
23+
:members:
24+
25+
1726
|Run| objects
1827
-------------
1928

docs/conf.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,27 @@
6969
rst_epilog = """
7070
.. |api-Document| replace:: :class:`docx.api.Document`
7171
72-
.. |_Body| replace:: :class:`_Body`
72+
.. |_Body| replace:: :class:`._Body`
7373
74-
.. |_Cell| replace:: :class:`_Cell`
74+
.. |_Cell| replace:: :class:`._Cell`
7575
76-
.. |_Column| replace:: :class:`_Column`
76+
.. |_Column| replace:: :class:`._Column`
7777
78-
.. |_Columns| replace:: :class:`_Columns`
78+
.. |_Columns| replace:: :class:`._Columns`
7979
8080
.. |CoreProperties| replace:: :class:`.CoreProperties`
8181
82-
.. |datetime| replace:: :class:`datetime.datetime`
82+
.. |datetime| replace:: :class:`.datetime.datetime`
8383
8484
.. |Document| replace:: :class:`.Document`
8585
8686
.. |docx| replace:: ``python-docx``
8787
8888
.. |Emu| replace:: :class:`.Emu`
8989
90-
.. |False| replace:: ``False``
90+
.. |False| replace:: :class:`False`
91+
92+
.. |float| replace:: :class:`.float`
9193
9294
.. |Font| replace:: :class:`.Font`
9395
@@ -97,37 +99,41 @@
9799
98100
.. |InvalidSpanError| replace:: :class:`.InvalidSpanError`
99101
100-
.. |int| replace:: :class:`int`
102+
.. |int| replace:: :class:`.int`
101103
102104
.. |LatentStyles| replace:: :class:`.LatentStyles`
103105
104106
.. |Length| replace:: :class:`.Length`
105107
106-
.. |OpcPackage| replace:: :class:`OpcPackage`
108+
.. |OpcPackage| replace:: :class:`.OpcPackage`
107109
108-
.. |None| replace:: ``None``
110+
.. |None| replace:: :class:`.None`
109111
110-
.. |NumberingPart| replace:: :class:`NumberingPart`
112+
.. |NumberingPart| replace:: :class:`.NumberingPart`
111113
112114
.. |Paragraph| replace:: :class:`.Paragraph`
113115
114-
.. |Part| replace:: :class:`Part`
116+
.. |ParagraphFormat| replace:: :class:`.ParagraphFormat`
117+
118+
.. |Part| replace:: :class:`.Part`
119+
120+
.. |Pt| replace:: :class:`.Pt`
115121
116-
.. |_Relationship| replace:: :class:`_Relationship`
122+
.. |_Relationship| replace:: :class:`._Relationship`
117123
118-
.. |Relationships| replace:: :class:`_Relationships`
124+
.. |Relationships| replace:: :class:`._Relationships`
119125
120-
.. |_Row| replace:: :class:`_Row`
126+
.. |_Row| replace:: :class:`._Row`
121127
122-
.. |_Rows| replace:: :class:`_Rows`
128+
.. |_Rows| replace:: :class:`._Rows`
123129
124130
.. |Run| replace:: :class:`.Run`
125131
126132
.. |Section| replace:: :class:`.Section`
127133
128134
.. |Sections| replace:: :class:`.Sections`
129135
130-
.. |str| replace:: :class:`str`
136+
.. |str| replace:: :class:`.str`
131137
132138
.. |Style| replace:: :class:`.Style`
133139
@@ -139,7 +145,7 @@
139145
140146
.. |_Text| replace:: :class:`._Text`
141147
142-
.. |True| replace:: ``True``
148+
.. |True| replace:: :class:`True`
143149
144150
.. |ValueError| replace:: :class:`ValueError`
145151
"""

docs/dev/analysis/features/text/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ Text
55
.. toctree::
66
:titlesonly:
77

8+
paragraph-format
89
font
910
underline
10-
par-alignment
1111
run-content
1212
breaks
1313
char-style
14-
15-
Word supports the definition of *styles* to allow a group of formatting

docs/dev/analysis/features/text/par-alignment.rst

Lines changed: 0 additions & 174 deletions
This file was deleted.

0 commit comments

Comments
 (0)