Table Properties
================
Alignment
---------
Word allows a table to be aligned between the page margins either left,
right, or center.
The read/write :attr:`Table.alignment` property specifies the alignment for
a table::
>>> table = document.add_table(rows=2, cols=2)
>>> table.alignment
None
>>> table.alignment = WD_TABLE_ALIGNMENT.RIGHT
>>> table.alignment
RIGHT (2)
Autofit
-------
Word has two algorithms for laying out a table, *fixed-width* or `autofit`.
The default is autofit. Word will adjust column widths in an autofit table
based on cell contents. A fixed-width table retains its column widths
regardless of the contents. Either algorithm will adjust column widths
proportionately when total table width exceeds page width.
The read/write :attr:`Table.allow_autofit` property specifies which algorithm
is used::
>>> table = document.add_table(rows=2, cols=2)
>>> table.allow_autofit
True
>>> table.allow_autofit = False
>>> table.allow_autofit
False
Specimen XML
------------
.. highlight:: xml
The following XML represents a 2x2 table::
Layout behavior
---------------
Auto-layout causes actual column widths to be both unpredictable and
unstable. Changes to the content can make the table layout shift.
Semantics of CT_TblWidth element
--------------------------------
e.g. ``tcW``::
ST_MeasurementOrPercent
|
+-- ST_DecimalNumberOrPercent
| |
| +-- ST_UnqualifiedPercentage
| | |
| | +-- XsdInteger e.g. '1440'
| |
| +-- ST_Percentage e.g. '-07.43%'
|
+-- ST_UniversalMeasure e.g. '-04.34mm'
Schema Definitions
------------------
.. highlight:: xml
::