Text frames
A paragraph in a text frame (Word's w:framePr, the frame behind Word's envelope addresses, side heads and older
letterheads) is a box placed apart from the text, which flows past it. DocWright reads, writes and lays out frames as
Word does.
using DocWright.Core.Primitives;
using DocWright.Dom;
paragraph.Format.Frame = new TextFrame
{
Width = new Twips(2880), // 2 in; no width: the frame is its text's width
HorizontalSpace = new Twips(180), // the gap to the text beside it
Wrap = TextFrameWrap.Around, // NotBeside: text below it; None: text under it
VerticalAnchor = TextFrameAnchor.Text, // where its paragraph would be; Margin (the default) or Page
HorizontalAnchor = TextFrameAnchor.Margin, // Text (the column, the default), Margin or Page
XAlign = TextFrameHorizontalAlignment.Right, // or an offset: X
};
- Consecutive paragraphs with the same frame are one frame.
- The frame takes no room in the text: the paragraph after it starts where the framed one would have.
- With Around (or Auto, Word's default) the text runs beside the frame for its height,
HorizontalSpaceaway; NotBeside puts the text below it; None lets the text run under it. HeightwithHeightRule.Exactclips the frame;AtLeastholds it open; no height is its content's.- A style's frame reaches every paragraph of that style, and a paragraph's own frame merges onto it attribute by attribute, as Word merges them (Word's envelope paragraphs state only their wrap and take the rest from the style).
The text wraps beside a frame wherever it is placed: a frame below its paragraph's top (a Y offset) wraps the lines
it reaches, on both sides when there is room, and a frame placed from the margin or the page wraps the text before it on
its page as well as after it. A drop cap is a frame too: see Drop caps.