w:tblpPr (Floating Table Positioning)
Specifies that a table is a floating (text-wrap) table and defines its absolute or relative position on the page.
Parent elements
Description
w:tblpPr makes the table a floating object with text wrap, analogous to a floating frame for a paragraph. When present, the table is taken out of normal flow and positioned absolutely or relatively on the page.
It is defined in ECMA-376 Part 1 §17.4.55.
A table without w:tblpPr is an inline (in-flow) table.
Attributes
| Attribute | Type | Description |
|---|---|---|
w:leftFromText |
xsd:integer (twips) |
Horizontal distance from surrounding text to the table’s left edge. |
w:rightFromText |
xsd:integer (twips) |
Horizontal distance from surrounding text to the table’s right edge. |
w:topFromText |
xsd:integer (twips) |
Vertical distance from surrounding text to the table’s top edge. |
w:bottomFromText |
xsd:integer (twips) |
Vertical distance from surrounding text to the table’s bottom edge. |
w:vertAnchor |
ST_VAnchor |
Vertical position anchor: margin, page, text. |
w:horzAnchor |
ST_HAnchor |
Horizontal position anchor: margin, page, text. |
w:tblpXSpec |
ST_XAlign |
Named horizontal position: left, right, center, inside, outside. |
w:tblpYSpec |
ST_YAlign |
Named vertical position: top, bottom, center, inside, outside. |
w:tblpX |
xsd:integer (twips) |
Explicit horizontal position relative to w:horzAnchor. |
w:tblpY |
xsd:integer (twips) |
Explicit vertical position relative to w:vertAnchor. |
Examples
<!-- Float table to the right of the page with 144 twips (0.1 inch) text distance -->
<w:tblPr>
<w:tblpPr
w:horzAnchor="margin"
w:tblpXSpec="right"
w:vertAnchor="text"
w:tblpY="0"
w:rightFromText="144"
w:leftFromText="144"/>
</w:tblPr>
using DocumentFormat.OpenXml.Wordprocessing;
var tblPr = new TableProperties(
new TablePositionProperties
{
HorizontalAnchor = HorizontalAnchorValues.Margin,
TablePositionXAlignment = HorizontalAlignmentValues.Right,
VerticalAnchor = VerticalAnchorValues.Text,
TablePositionY = 0,
RightFromText = 144,
LeftFromText = 144
}
);
Notes
- Use either
w:tblpXSpec/w:tblpYSpec(named positions) orw:tblpX/w:tblpY(explicit coordinates) — not both for the same axis. - Text wraps around a floating table based on the
*FromTextdistances. - Setting both
w:tblpPrand a non-autow:tblWis necessary for most floating table scenarios.