@@ -7,6 +7,22 @@ properties affecting its size, appearance, and how the content it contains is
77formatted.
88
99
10+ Candidate protocol
11+ ------------------
12+
13+ Cell.vertical_alignment::
14+
15+ >>> from docx.enum.table import WD_CELL_ALIGN_VERTICAL
16+ >>> cell = table.add_row().cells[0]
17+ >>> cell
18+ <docx.table._Cell object at 0x...>
19+ >>> cell.vertical_alignment
20+ None
21+ >>> cell.vertical_alignment = WD_CELL_ALIGN_VERTICAL.CENTER
22+ >>> print(cell.vertical_alignment)
23+ CENTER (1)
24+
25+
1026MS API - Partial Summary
1127------------------------
1228
@@ -29,6 +45,25 @@ MS API - Partial Summary
2945* WordWrap
3046
3147
48+ WD_ALIGN_VERTICAL Enumeration
49+ ---------------------------------
50+
51+ wdAlignVerticalBoth (101)
52+ This is an option in the OpenXml spec, but not in Word itself. It's not
53+ clear what Word behavior this setting produces. If you find out please let
54+ us know and we'll update the documentation. Otherwise, probably best to
55+ avoid this option.
56+
57+ wdAlignVerticalBottom (3)
58+ Text is aligned to the bottom border of the cell.
59+
60+ wdAlignVerticalCenter (1)
61+ Text is aligned to the center of the cell.
62+
63+ wdAlignVerticalTop (0)
64+ Text is aligned to the top border of the cell.
65+
66+
3267Specimen XML
3368------------
3469
@@ -39,6 +74,7 @@ Specimen XML
3974 <w:tc>
4075 <w:tcPr>
4176 <w:tcW w:w="7038" w:type="dxa"/>
77+ <w:vAlign w:val="bottom"/>
4278 </w:tcPr>
4379 <w:p>
4480 <w:pPr>
@@ -127,22 +163,18 @@ Schema Definitions
127163 <xsd:attribute name="type" type="ST_TblWidth"/>
128164 </xsd:complexType>
129165
130- <xsd:simpleType name="ST_MeasurementOrPercent">
131- <xsd:union memberTypes="ST_DecimalNumberOrPercent s:ST_UniversalMeasure"/>
132- </xsd:simpleType>
166+ <xsd:complexType name="CT_VerticalJc">
167+ <xsd:attribute name="val" type="ST_VerticalJc" use="required"/>
168+ </xsd:complexType>
169+
170+ <!-- simple types -->
133171
134172 <xsd:simpleType name="ST_DecimalNumberOrPercent">
135173 <xsd:union memberTypes="ST_UnqualifiedPercentage s:ST_Percentage"/>
136174 </xsd:simpleType>
137175
138- <xsd:simpleType name="ST_UniversalMeasure">
139- <xsd:restriction base="xsd:string">
140- <xsd:pattern value="-?[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)"/>
141- </xsd:restriction>
142- </xsd:simpleType>
143-
144- <xsd:simpleType name="ST_UnqualifiedPercentage">
145- <xsd:restriction base="xsd:integer"/>
176+ <xsd:simpleType name="ST_MeasurementOrPercent">
177+ <xsd:union memberTypes="ST_DecimalNumberOrPercent s:ST_UniversalMeasure"/>
146178 </xsd:simpleType>
147179
148180 <xsd:simpleType name="ST_Percentage">
@@ -160,6 +192,25 @@ Schema Definitions
160192 </xsd:restriction>
161193 </xsd:simpleType>
162194
195+ <xsd:simpleType name="ST_UniversalMeasure">
196+ <xsd:restriction base="xsd:string">
197+ <xsd:pattern value="-?[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)"/>
198+ </xsd:restriction>
199+ </xsd:simpleType>
200+
201+ <xsd:simpleType name="ST_UnqualifiedPercentage">
202+ <xsd:restriction base="xsd:integer"/>
203+ </xsd:simpleType>
204+
205+ <xsd:simpleType name="ST_VerticalJc">
206+ <xsd:restriction base="xsd:string">
207+ <xsd:enumeration value="top"/>
208+ <xsd:enumeration value="center"/>
209+ <xsd:enumeration value="both"/>
210+ <xsd:enumeration value="bottom"/>
211+ </xsd:restriction>
212+ </xsd:simpleType>
213+
163214
164215.. _`WdRowHeightRule` :
165216 http://msdn.microsoft.com/en-us/library/office/ff193620(v=office.15).aspx
0 commit comments