DrawingML Tables - Cell Properties - Text Alignment, Margins and Direction
Each cell may have a set of properties specified within a <a:tcPr> element, which is a child of the <a:tc> element.
Properties related to horizontal and vertical alignment, margins, content direction, and text overflow are determined by attributes of the <a:tcPr> element. Below are the permitted attributes.
Attribute | Description |
---|---|
anchor | Defines the alignment of text vertically within a cell. E.g., <a:tcPr anchor="ctr">. Possible values are:
|
anchorCtr | Values are booleans. When true, it modifies the anchor attribute and centers the text box itself so that, for example, the text can be left-aligned along the center of the cell. |
horzOverflow | Specifies the clipping behavior of the cell. When the value is overflow (<a:tcPr horzOverflow="overflow">), text in the cell freely flows outside the cell boundaries and is visible. When the value is clip, the text is clipped and does not appear outside of the cell boundaries. |
marB | Specifies the bottom margin of the cell. E.g., <a:tcPr marB="45720" anchor="ctr">. Values can be in EMUs or as a number followed by a unit identifier. |
marL | Specifies the left margin of the cell. Values can be in EMUs or as a number followed by a unit identifier. |
marR | Specifies the right margin of the cell. Values can be in EMUs or as a number followed by a unit identifier. |
marT | Specifies the top margin of the cell. Values can be in EMUs or as a number followed by a unit identifier. |
vert | Defines the text direction for the cell. Possible values include (omitting the East Asian options):
|
Text Alignment
Below is a sample of a cell that has its content centered vertically--i.e., the anchor attribute has a value of ctr.
If we change the above xml to add the anchorCtr to true (<a:tcPr anchor="ctr" anchorCtr="1"/>), the text centers as shown below:
Cell Margins
Margins for text within a cell are set by attribute values on the <a:tcPr> element. For example, below is a sample of a cell with left and top margins set to one inch or 914400 EMUs (<a:tcPr marL="914400" marT="914400"/>):
Text Direction
The direction of text within a table cell is determined by the vert attribute on the <a:tcPr> element. Below is an example of the direction set to vert (<a:tcPr vert="vert"/>).
Below is an example of the direction set to vert270 (<a:tcPr vert="vert270"/>).
Text Overflow
Whether text flows outside of the cell or is clipped is determined by the horzOverflow attribute on the <a:tcPr> element. Below is an example of the overflow set to overflow (<a:tcPr vert="wordArtVert" horzOverflow="overflow"/>).
To clip the text, set the overflow to clip (<a:tcPr vert="wordArtVert" horzOverflow="clip"/>).