Skip to content

Commit 221e28c

Browse files
author
Steve Canny
committed
enum: add WD_TABLE_DIRECTION enumeration
1 parent 7541f20 commit 221e28c

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

docs/api/enum/WdTableDirection.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _WdTableDirection:
2+
3+
``WD_TABLE_DIRECTION``
4+
======================
5+
6+
Specifies the direction in which an application orders cells in the
7+
specified table or row.
8+
9+
Example::
10+
11+
from docx.enum.table import WD_TABLE_DIRECTION
12+
13+
table = document.add_table(3, 3)
14+
table.direction = WD_TABLE_DIRECTION.RTL
15+
16+
----
17+
18+
LTR
19+
The table or row is arranged with the first column in the leftmost
20+
position.
21+
22+
RTL
23+
The table or row is arranged with the first column in the rightmost
24+
position.

docs/api/enum/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ can be found here:
1717
WdSectionStart
1818
WdStyleType
1919
WdRowAlignment
20+
WdTableDirection
2021
WdUnderline

docx/enum/table.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
Enumerations related to tables in WordprocessingML files
55
"""
66

7-
from __future__ import absolute_import, print_function, unicode_literals
7+
from __future__ import (
8+
absolute_import, division, print_function, unicode_literals
9+
)
810

9-
from .base import XmlEnumeration, XmlMappedEnumMember
11+
from .base import (
12+
Enumeration, EnumMember, XmlEnumeration, XmlMappedEnumMember
13+
)
1014

1115

1216
class WD_TABLE_ALIGNMENT(XmlEnumeration):
@@ -36,3 +40,32 @@ class WD_TABLE_ALIGNMENT(XmlEnumeration):
3640
'RIGHT', 2, 'right', 'Right-aligned.'
3741
),
3842
)
43+
44+
45+
class WD_TABLE_DIRECTION(Enumeration):
46+
"""
47+
Specifies the direction in which an application orders cells in the
48+
specified table or row.
49+
50+
Example::
51+
52+
from docx.enum.table import WD_TABLE_DIRECTION
53+
54+
table = document.add_table(3, 3)
55+
table.direction = WD_TABLE_DIRECTION.RTL
56+
"""
57+
58+
__ms_name__ = 'WdTableDirection'
59+
60+
__url__ = ' http://msdn.microsoft.com/en-us/library/ff835141.aspx'
61+
62+
__members__ = (
63+
EnumMember(
64+
'LTR', 0, 'The table or row is arranged with the first column '
65+
'in the leftmost position.'
66+
),
67+
EnumMember(
68+
'RTL', 1, 'The table or row is arranged with the first column '
69+
'in the rightmost position.'
70+
),
71+
)

0 commit comments

Comments
 (0)