# HeaderFooterCollection Class

> An instance of the HeaderFooterCollection class contains the headers and footers in a Text Control document represented through objects of the type HeaderFooter. An instance of this class can be either obtained through the TextControl.HeadersAndFooters or through the Section.HeadersAndFooters property. The first collection represents headers and footers common to all sections of the document and the second collection represents the headers and footers of a certain section. The HeaderFooterCollection class implements the IEnumerable and the ICollection interface.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **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
- **Implements:** `System.Collections.ICollection`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > HeaderFooterCollection Class
- **859 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/llms-full.txt

---

### Description

An instance of the HeaderFooterCollection class contains the headers and footers in a Text Control document represented through objects of the type [HeaderFooter](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/llms-full.txt). An instance of this class can be either obtained through the [TextControl.HeadersAndFooters](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/headersandfooters-property/llms-full.txt) or through the [Section.HeadersAndFooters](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/section/headersandfooters-property/llms-full.txt) property. The first collection represents headers and footers common to all sections of the document and the second collection represents the headers and footers of a certain section. The HeaderFooterCollection class implements the IEnumerable and the ICollection interface.

### Syntax

```csharp
public class HeaderFooterCollection : ICollection, IEnumerable
```

```vbnet
Public Class HeaderFooterCollection
    Implements ICollection, IEnumerable
```

### Examples

The following example works with headers and footers in the current document.

```csharp
HeaderFooterCollection headerFooterCollection = textControl.HeadersAndFooters;
headerFooterCollection.Add(HeaderFooterType.Header);
```

```vbnet
Dim headerFooterCollection As HeaderFooterCollection = textControl.HeadersAndFooters
headerFooterCollection.Add(HeaderFooterType.Header)
```

---

## In This Section

- [HeaderFooterCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/add-method/llms-full.txt): 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.
- [HeaderFooterCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [HeaderFooterCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/count-property/llms-full.txt): Gets the number of elements contained in the collection.
- [HeaderFooterCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/getenumerator-method/llms-full.txt): Returns an enumerator that can be used to iterate through the collection.
- [HeaderFooterCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/getitem-method/llms-full.txt): Gets a particular header or footer from the collection. If the specified header or footer does not exist in the collection an ArgumentException is thrown.
- [HeaderFooterCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/remove-method/llms-full.txt): Removes a header or footer from a Text Control document or from a certain section. To remove more than one header or footer a combination of the HeaderFooterType enumeration can be used.

---

## Nearby

- **Previous:** [HeaderFooter.Type Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/type-property/llms-full.txt)
- **Next:** [HeaderFooterCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/add-method/llms-full.txt)
