# HeaderFooterCollection.Add Method

> 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.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > HeaderFooterCollection.Add Method
- **969 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/add-method/llms-full.txt

---

### 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](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootertype/enumeration/llms-full.txt) enumeration values can be used.

### Syntax

```csharp
public bool Add(HeaderFooterType headerFooterType);
```

```vbnet
Public Function Add(headerFooterType As HeaderFooterType) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| headerFooterType | Specifies the headers and/or footers to add. A combination of the following values of the [HeaderFooterType](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootertype/enumeration/llms-full.txt) enumeration is possible:  \| Value \| Meaning \| \| Header \| Adds a header to the document. \| \| FirstPageHeader \| Adds a special header to the document's first page. \| \| Footer \| Adds a footer to the document. \| \| FirstPageFooter \| Adds a special footer to the document's first page. \| \| EvenHeader \| Adds an even header to the document. Even and odd headers can only exist together. If a header already exists, the existing header becomes the odd header. Otherwise an odd header is also created. \| \| EvenFooter \| Adds an even footer to the document. Even and odd footers can only exist together. If a footer already exists, the existing footer becomes the odd footer. Otherwise an odd footer is also created. \| \| All \| Adds all headers and footers. \| |
|---|

### 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.

```csharp
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;
}
```

```vbnet
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
```

---

## Nearby

- **Previous:** [HeaderFooterCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/llms-full.txt)
- **Next:** [HeaderFooterCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/copyto-method/llms-full.txt)
