Add Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Adds a new header or footer to a Text Control document or to a certain section of the document. If a header or footer is added to the complete document the first section receives the header or footer and all other sections receive headers or footers which are connected to their previous section. To add more than one header or footer a combination of the HeaderFooterType enumeration values can be used.
Syntax
public bool Add(HeaderFooterType headerFooterType);Public Function Add(headerFooterType As HeaderFooterType) As BooleanParameters
| Parameter | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| headerFooterType | Specifies the headers and/or footers to add. A combination of the following values of the HeaderFooterType enumeration is possible:
|
Return Value
The return value is true, if the header or footer could be added. Otherwise it is false.
Examples
The following example adds a footer and inserts a centered confidentiality notice.
HeaderFooterCollection headersAndFooters = textControl.Sections[1].HeadersAndFooters;
if (headersAndFooters.Add(HeaderFooterType.Footer))
{
HeaderFooter footer = headersAndFooters.GetItem(HeaderFooterType.Footer);
footer.Selection.Text = "Confidential";
footer.Selection.ParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center;
}Dim headersAndFooters As HeaderFooterCollection = textControl.Sections(1).HeadersAndFooters
If headersAndFooters.Add(HeaderFooterType.Footer) Then
Dim footer As HeaderFooter = headersAndFooters.GetItem(HeaderFooterType.Footer)
footer.Selection.Text = "Confidential"
footer.Selection.ParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center
End If