@@ -93,40 +93,87 @@ inheritance from the style hierarchy::
9393 >>> paragraph = document.add_paragraph()
9494 >>> paragraph_format = paragraph.paragraph_format
9595
96- >>> paragraph .left_indent
96+ >>> paragraph_format .left_indent
9797 None # indicating indentation is inherited from the style hierarchy
98- >>> paragraph .left_indent = Inches(0.5)
99- >>> paragraph .left_indent
98+ >>> paragraph_format .left_indent = Inches(0.5)
99+ >>> paragraph_format .left_indent
100100 457200
101- >>> paragraph .left_indent.inches
101+ >>> paragraph_format .left_indent.inches
102102 0.5
103103
104104
105105Right-side indent works in a similar way::
106106
107107 >>> from docx.shared import Pt
108- >>> paragraph .right_indent
108+ >>> paragraph_format .right_indent
109109 None
110- >>> paragraph .right_indent = Pt(24)
111- >>> paragraph .right_indent
110+ >>> paragraph_format .right_indent = Pt(24)
111+ >>> paragraph_format .right_indent
112112 304800
113- >>> paragraph .right_indent.pt
113+ >>> paragraph_format .right_indent.pt
114114 24.0
115115
116116
117+
118+
117119First-line indent is specified using the
118120:attr: `~.ParagraphFormat.first_line_indent ` property and is interpreted
119121relative to the left indent. A negative value indicates a hanging indent::
120122
121- >>> paragraph .first_line_indent
123+ >>> paragraph_format .first_line_indent
122124 None
123- >>> paragraph .first_line_indent = Inches(-0.25)
124- >>> paragraph .first_line_indent
125+ >>> paragraph_format .first_line_indent = Inches(-0.25)
126+ >>> paragraph_format .first_line_indent
125127 -228600
126- >>> paragraph .first_line_indent.inches
128+ >>> paragraph_format .first_line_indent.inches
127129 -0.25
128130
129131
132+ Tab stops
133+ ~~~~~~~~~
134+
135+ A tab stop determines the rendering of a tab character in the text of
136+ a paragraph. In particular, it specifies the position where the text
137+ following the tab character will start, how it will be aligned to that
138+ position, and an optional leader character that will fill the horizontal
139+ space spanned by the tab.
140+
141+ The tab stops for a paragraph or style are contained in a |TabStops | object
142+ accessed using the :attr: `~.ParagraphFormat.tab_stops ` property on
143+ |ParagraphFormat |::
144+
145+ >>> tab_stops = paragraph_format.tab_stops
146+ >>> tab_stops
147+ <docx.text.tabstops.TabStops object at 0x106b802d8>
148+
149+ A new tab stop is added using the :meth: `~.TabStops.add_tab_stop ` method::
150+
151+ >>> tab_stop = tab_stops.add_tab_stop(Inches(1.5))
152+ >>> tab_stop.position
153+ 1371600
154+ >>> tab_stop.position.inches
155+ 1.5
156+
157+ Alignment defaults to left, but may be specified by providing a member of the
158+ :ref: `WdTabAlignment ` enumeration. The leader character defaults to spaces,
159+ but may be specified by providing a member of the :ref: `WdTabLeader `
160+ enumeration::
161+
162+ >>> from docx.enum.text import WD_TAB_ALIGNMENT, WD_TAB_LEADER
163+ >>> tab_stop = tab_stops.add_tab_stop(Inches(1.5), WD_TAB_ALIGNMENT.RIGHT, WD_TAB_LEADER.DOTS)
164+ >>> print(tab_stop.alignment)
165+ RIGHT (2)
166+ >>> print(tab_stop.leader)
167+ DOTS (1)
168+
169+ Existing tab stops are accessed using sequence semantics on |TabStops |::
170+
171+ >>> tab_stops[0]
172+ <docx.text.tabstops.TabStop object at 0x1105427e8>
173+
174+ More details are available in the |TabStops | and |TabStop | API documentation
175+
176+
130177Paragraph spacing
131178~~~~~~~~~~~~~~~~~
132179
@@ -177,7 +224,7 @@ of the :ref:`WdLineSpacing` enumeration or |None|::
177224 None
178225
179226 >>> paragraph_format.line_spacing = Pt(18)
180- >>> isinstance(Length, paragraph_format.line_spacing)
227+ >>> isinstance(paragraph_format.line_spacing, Length )
181228 True
182229 >>> paragraph_format.line_spacing.pt
183230 18.0
0 commit comments