Skip to content

Commit

Permalink
enum: add WD_TABLE_DIRECTION enumeration
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Canny committed Feb 21, 2015
1 parent 7541f20 commit 221e28c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
24 changes: 24 additions & 0 deletions docs/api/enum/WdTableDirection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. _WdTableDirection:

``WD_TABLE_DIRECTION``
======================

Specifies the direction in which an application orders cells in the
specified table or row.

Example::

from docx.enum.table import WD_TABLE_DIRECTION

table = document.add_table(3, 3)
table.direction = WD_TABLE_DIRECTION.RTL

----

LTR
The table or row is arranged with the first column in the leftmost
position.

RTL
The table or row is arranged with the first column in the rightmost
position.
1 change: 1 addition & 0 deletions docs/api/enum/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ can be found here:
WdSectionStart
WdStyleType
WdRowAlignment
WdTableDirection
WdUnderline
37 changes: 35 additions & 2 deletions docx/enum/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
Enumerations related to tables in WordprocessingML files
"""

from __future__ import absolute_import, print_function, unicode_literals
from __future__ import (
absolute_import, division, print_function, unicode_literals
)

from .base import XmlEnumeration, XmlMappedEnumMember
from .base import (
Enumeration, EnumMember, XmlEnumeration, XmlMappedEnumMember
)


class WD_TABLE_ALIGNMENT(XmlEnumeration):
Expand Down Expand Up @@ -36,3 +40,32 @@ class WD_TABLE_ALIGNMENT(XmlEnumeration):
'RIGHT', 2, 'right', 'Right-aligned.'
),
)


class WD_TABLE_DIRECTION(Enumeration):
"""
Specifies the direction in which an application orders cells in the
specified table or row.
Example::
from docx.enum.table import WD_TABLE_DIRECTION
table = document.add_table(3, 3)
table.direction = WD_TABLE_DIRECTION.RTL
"""

__ms_name__ = 'WdTableDirection'

__url__ = ' http://msdn.microsoft.com/en-us/library/ff835141.aspx'

__members__ = (
EnumMember(
'LTR', 0, 'The table or row is arranged with the first column '
'in the leftmost position.'
),
EnumMember(
'RTL', 1, 'The table or row is arranged with the first column '
'in the rightmost position.'
),
)

0 comments on commit 221e28c

Please sign in to comment.