Skip to content

Commit 38aeb63

Browse files
onlyjusSteve Canny
authored andcommitted
enum: add WD_PARAGRAPH_ALIGNMENT enumeration
1 parent 0138500 commit 38aeb63

3 files changed

Lines changed: 102 additions & 1 deletion

File tree

docs/api/enum/WdAlignParagraph.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.. _WdParagraphAlignment:
2+
3+
``WD_PARAGRAPH_ALIGNMENT``
4+
==========================
5+
6+
alias: **WD_ALIGN_PARAGRAPH**
7+
8+
Specifies paragraph justification type.
9+
10+
Example::
11+
12+
from docx.enum.text import WD_ALIGN_PARAGRAPH
13+
14+
paragraph = document.add_paragraph()
15+
paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER
16+
17+
----
18+
19+
LEFT
20+
Left-aligned
21+
22+
CENTER
23+
Center-aligned.
24+
25+
RIGHT
26+
Right-aligned.
27+
28+
JUSTIFY
29+
Fully justified.
30+
31+
DISTRIBUTE
32+
Paragraph characters are distributed to fill the entire width of the
33+
paragraph.
34+
35+
JUSTIFY_MED
36+
Justified with a medium character compression ratio.
37+
38+
JUSTIFY_HI
39+
Justified with a high character compression ratio.
40+
41+
JUSTIFY_LOW
42+
Justified with a low character compression ratio.
43+
44+
THAI_JUSTIFY
45+
Justified according to Thai formatting layout.

docs/api/enum/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ can be found here:
88
.. toctree::
99
:titlesonly:
1010

11+
WdAlignParagraph
1112
WdOrientation
1213
WdSectionStart
1314
WdUnderline

docx/enum/text.py

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,62 @@
66

77
from __future__ import absolute_import, print_function, unicode_literals
88

9-
from .base import XmlEnumeration, XmlMappedEnumMember
9+
from .base import alias, XmlEnumeration, XmlMappedEnumMember
10+
11+
12+
@alias('WD_ALIGN_PARAGRAPH')
13+
class WD_PARAGRAPH_ALIGNMENT(XmlEnumeration):
14+
"""
15+
alias: **WD_ALIGN_PARAGRAPH**
16+
17+
Specifies paragraph justification type.
18+
19+
Example::
20+
21+
from docx.enum.text import WD_ALIGN_PARAGRAPH
22+
23+
paragraph = document.add_paragraph()
24+
paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER
25+
"""
26+
27+
__ms_name__ = 'WdParagraphAlignment'
28+
29+
__url__ = 'http://msdn.microsoft.com/en-us/library/office/ff835817.aspx'
30+
31+
__members__ = (
32+
XmlMappedEnumMember(
33+
'LEFT', 0, 'left', 'Left-aligned'
34+
),
35+
XmlMappedEnumMember(
36+
'CENTER', 1, 'center', 'Center-aligned.'
37+
),
38+
XmlMappedEnumMember(
39+
'RIGHT', 2, 'right', 'Right-aligned.'
40+
),
41+
XmlMappedEnumMember(
42+
'JUSTIFY', 3, 'both', 'Fully justified.'
43+
),
44+
XmlMappedEnumMember(
45+
'DISTRIBUTE', 4, 'distribute', 'Paragraph characters are distrib'
46+
'uted to fill the entire width of the paragraph.'
47+
),
48+
XmlMappedEnumMember(
49+
'JUSTIFY_MED', 5, 'mediumKashida', 'Justified with a medium char'
50+
'acter compression ratio.'
51+
),
52+
XmlMappedEnumMember(
53+
'JUSTIFY_HI', 7, 'highKashida', 'Justified with a high character'
54+
' compression ratio.'
55+
),
56+
XmlMappedEnumMember(
57+
'JUSTIFY_LOW', 8, 'lowKashida', 'Justified with a low character '
58+
'compression ratio.'
59+
),
60+
XmlMappedEnumMember(
61+
'THAI_JUSTIFY', 9, 'thaiDistribute', 'Justified according to Tha'
62+
'i formatting layout.'
63+
),
64+
)
1065

1166

1267
class WD_BREAK_TYPE(object):

0 commit comments

Comments
 (0)