w:framePr (Text Frame Properties)
Defines a paragraph as a legacy text frame, specifying its size, position, and text-wrap behavior relative to surrounding content.
Parent elements
Description
w:framePr turns a paragraph into a legacy text frame — a floating block of text positioned relative to the page, column, or margin. All paragraphs that belong to the same logical frame share identical w:framePr attributes.
It is defined in ECMA-376 Part 1 §17.3.1.11.
Note: Legacy text frames predate DrawingML. Modern floating content should use
w:drawingwithwp:anchor. Text frames are preserved for backward compatibility.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:w |
ST_TwipsMeasure |
Non-negative integer (twips) | Width of the frame. |
w:h |
ST_TwipsMeasure |
Non-negative integer (twips) | Height of the frame. |
w:hRule |
ST_HeightRule |
auto, atLeast, exact |
Height rule: auto-size, minimum, or exact. |
w:hAnchor |
ST_HAnchor |
text, margin, page |
Horizontal anchor reference. |
w:vAnchor |
ST_VAnchor |
text, margin, page |
Vertical anchor reference. |
w:x |
ST_SignedTwipsMeasure |
Signed integer (twips) | Horizontal position offset from anchor. |
w:xAlign |
ST_XAlign |
left, right, center, inside, outside |
Horizontal alignment relative to anchor (overrides w:x). |
w:y |
ST_SignedTwipsMeasure |
Signed integer (twips) | Vertical position offset from anchor. |
w:yAlign |
ST_YAlign |
inline, top, center, bottom, inside, outside |
Vertical alignment relative to anchor (overrides w:y). |
w:hSpace |
ST_TwipsMeasure |
Non-negative integer (twips) | Horizontal distance between frame and surrounding text. |
w:vSpace |
ST_TwipsMeasure |
Non-negative integer (twips) | Vertical distance between frame and surrounding text. |
w:wrap |
ST_Wrap |
auto, notBeside, around, tight, through, none |
Text wrapping mode. |
w:lines |
xsd:integer |
Positive integer | Number of lines (used when w:hRule="auto"). |
w:anchorLock |
ST_OnOff |
true, false |
Prevents the user from moving the frame anchor. |
Examples
<!-- Legacy text frame: 3 inches wide, positioned 1 inch from top of page margin, wrapping text around it -->
<w:p>
<w:pPr>
<w:framePr
w:w="4320"
w:h="1440"
w:hRule="exact"
w:hAnchor="margin"
w:vAnchor="margin"
w:x="720"
w:y="1440"
w:hSpace="180"
w:vSpace="0"
w:wrap="around"/>
</w:pPr>
<w:r><w:t>Text frame content.</w:t></w:r>
</w:p>
using DocumentFormat.OpenXml.Wordprocessing;
var para = new Paragraph(
new ParagraphProperties(
new FrameProperties
{
Width = "4320",
Height = "1440",
HeightType = HeightRuleValues.Exact,
HorizontalAnchor = HorizontalAnchorValues.Margin,
VerticalAnchor = VerticalAnchorValues.Margin,
X = "720",
Y = "1440",
HorizontalSpace = "180",
VerticalSpace = "0",
Wrap = TextWrappingValues.Around
}
),
new Run(new Text("Text frame content."))
);
Notes
- Multiple consecutive paragraphs with identical
w:framePrattributes belong to the same logical frame. w:x="0" w:xAlignorw:y="0" w:yAligncombinations select edge-aligned positions without explicit coordinates.- Measurements: 1 inch = 1440 twips, 1 cm ≈ 567 twips.