In the recently released version X15 of TX Text Control, all types of objects can be placed into a header and footer that overlap the main text. Consider the following letterhead design:
On the left side (margin), the company address and phone number (red icons) are placed left from the main text area. This area is part of the header and is positioned behind the text. This area is part of the letterhead header and is repeated automatically on newly added pages.
Looking at the design view of the document in TX Text Control, you can see the TextFrame overlapping the main text area:
When a header/footer is active, TextFrames added using the ribbon bar, are automatically inserted behind the text and positioned fixed on page which is the required condition under that objects overlap the main text.
In order to insert an object to a header programmatically, the object needs to be added "fixed on page" and the TXText
╰ TXTextControl Namespace
╰ FrameBase Class
╰ InsertionMode Property
Gets or sets a value determining whether the frame is treated as a single character or the document's text either flows around or overwrites the frame. must be defined as BelowTheText and FixedOnPage.
// add a header | |
textControl1.Sections.GetItem().HeadersAndFooters.Add(HeaderFooterType.Header); | |
// retrieve the inserted header | |
HeaderFooter hed = textControl1.Sections.GetItem().HeadersAndFooters.GetItem( | |
HeaderFooterType.Header); | |
// create a new TextFrame | |
TextFrame frame = new TextFrame(new Size(3000, 3000)); | |
// add the TextFrame to the header | |
hed.TextFrames.Add(frame, | |
textControl1.InputPosition.Page, // fixed on page | |
new Point(0, 2000), | |
TextFrameInsertionMode.BelowTheText | TextFrameInsertionMode.FixedOnPage); | |
// add text to TextFrame | |
frame.Selection.Text = "New TextFrame"; |