Products Technologies Demo Docs Blog Support Company

Adding Images and Text Frames to Headers and Footers

Since version X15, images can be added to headers and footers the overlap the main text as background images or watermarks.

Adding Images and Text Frames to Headers and Footers

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:

Letterhead

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:

Letterhead

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 TXTextControl.FrameBase.InsertionMode property 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";

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Also See

This post references the following in the documentation:

  • TXTextControl.FrameBase.InsertionMode Property

Windows Forms

Text Control combines the power of a reporting tool and an easy-to-use WYSIWYG word processor - fully programmable and embeddable in your Windows Forms application. TX Text Control .NET for Windows Forms is a royalty-free, fully programmable rich edit control that offers developers a broad range of word processing features in a reusable component for Visual Studio.

See Windows Forms products

Related Posts

ASP.NETReportingWindows Forms

Sneak Peek X15: MS Word Compatible Document Protection and Editable Regions

In version X15, admin users are able to protect a document and to add editable regions to a document. This article gives an overview of the new UI and functionality for this feature.


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP2 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ActiveXASP.NETWindows Forms

Service Pack Releases: What's New in TX Text Control 33.0 SP1 and 32.0 SP5

TX Text Control 33.0 Service Pack 1 and TX Text Control 32.0 Service Pack 5 have been released, providing important updates and bug fixes across platforms. These service packs improve the…


ASP.NETWindows FormsWPF

The Wait is Over: TX Text Control for Linux is Officially Here

We are very excited to announce the release of TX Text Control 33.0 which includes the long awaited Linux version of TX Text Control. This version allows you to integrate TX Text Control into your…