# WordHeaderScope

Edits one WordHeader: its fluent methods and keywords, each returning this scope.

Class 

`OfficeIMO.Word`

**Namespace**

`OfficeIMO.Word`

**Assembly**

`OfficeIMO.Word`

**Source revision**

`105ae88c45f6` with working tree changes

**Source**

[WordScopes.cs:102](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/Sources/OfficeIMO.Word/Scopes/WordScopes.cs#L102)

**Modifiers**

sealed

Edits one [WordHeader](/api/word/officeimo-word-wordheader/): its fluent methods and keywords, each returning this scope.

## Inheritance

- object
- WordHeaderScope

## Usage

Explore 19 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 14

- Method [WordHeaderScope.Bookmark](/api/word/officeimo-word-wordheaderscope/#method-bookmark-string-action-officeimo-word-wordbookmarkscope)
- Method [WordHeaderScope.Field](/api/word/officeimo-word-wordheaderscope/#method-field-officeimo-word-wordfieldbuilder-boolean-action-officeimo-word-wordfieldscope)
- Method [WordHeaderScope.Fields](/api/word/officeimo-word-wordheaderscope/#method-fields-collections-generic-ienumerable-officeimo-word-wordfield)
- Method [WordHeaderScope.HorizontalLine](/api/word/officeimo-word-wordheaderscope/#method-horizontalline-nullable-officeimo-word-wordborderstyle-nullable-officeimo-officecolor-uint32-uint32-action-officeimo-word-wordparagraphscope)
- Method [WordHeaderScope.HyperLink](/api/word/officeimo-word-wordheaderscope/#method-hyperlink-string-string-boolean-string-boolean-action-officeimo-word-wordhyperlinkscope)
- Method [WordHeaderScope.Image](/api/word/officeimo-word-wordheaderscope/#method-image-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-word-wordimageoptions-action-officeimo-word-wordimagescope)
- Method [WordHeaderScope.List](/api/word/officeimo-word-wordheaderscope/#method-list-officeimo-word-wordliststyle-action-officeimo-word-wordlistscope)
- Method [WordHeaderScope.PageNumber](/api/word/officeimo-word-wordheaderscope/#method-pagenumber-boolean-nullable-officeimo-word-wordfieldformat-string-action-officeimo-word-wordparagraphscope)
- Method [WordHeaderScope.Paragraph](/api/word/officeimo-word-wordheaderscope/#method-paragraph-action-officeimo-word-wordparagraphscope)
- Method [WordHeaderScope.Paragraphs](/api/word/officeimo-word-wordheaderscope/#method-paragraphs-collections-generic-ienumerable-officeimo-word-wordparagraph)
- Method [WordHeaderScope.Shape](/api/word/officeimo-word-wordheaderscope/#method-shape-officeimo-word-wordshapetype-officeimo-officelength-officeimo-officelength-nullable-officeimo-officecolor-nullable-officeimo-officecolor-nullable-officeimo-officelength-double-action-officeimo-word-wordshapescope)
- Method [WordHeaderScope.Table](/api/word/officeimo-word-wordheaderscope/#method-table-int32-int32-officeimo-word-wordtablestyle-action-officeimo-word-wordtablescope)
- Method [WordHeaderScope.TextBox](/api/word/officeimo-word-wordheaderscope/#method-textbox-string-officeimo-word-wordimagetextwrapping-action-officeimo-word-wordtextboxscope)
- Method [WordHeaderScope.Watermark](/api/word/officeimo-word-wordheaderscope/#method-watermark-officeimo-word-wordwatermarkstyle-string-nullable-officeimo-officelength-nullable-officeimo-officelength-double-action-officeimo-word-wordwatermarkscope)

### Accepted by parameters 5

- Method [WordDocumentScope.Header](/api/word/officeimo-word-worddocumentscope/#method-header-action-officeimo-word-wordheaderscope) parameter `configure`
- Method [WordPageSetupScope.EvenPageHeader](/api/word/officeimo-word-wordpagesetupscope/#method-evenpageheader-action-officeimo-word-wordheaderscope) parameter `configure`
- Method [WordPageSetupScope.FirstPageHeader](/api/word/officeimo-word-wordpagesetupscope/#method-firstpageheader-action-officeimo-word-wordheaderscope) parameter `configure`
- Method [WordPageSetupScope.Header](/api/word/officeimo-word-wordpagesetupscope/#method-header-action-officeimo-word-wordheaderscope) parameter `configure`
- Method [WordSectionScope.Header](/api/word/officeimo-word-wordsectionscope/#method-header-action-officeimo-word-wordheaderscope) parameter `configure`

Filter members 

Show inherited

## Methods

`public WordHeaderScope Bookmark(string bookmarkName, Action<WordBookmarkScope>? configure = null)` [#](#method-bookmark-string-action-officeimo-word-wordbookmarkscope)

Adds a bookmark at the current location.

Parameters

**bookmarkName string required**

Name of the bookmark.

**configure System.Action<OfficeIMO.Word.WordBookmarkScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

Field 4 overloads

`public WordHeaderScope Field(WordField item)` [#](#method-field-officeimo-word-wordfield)

Adds an item to [WordHeaderFooter.Fields](/api/word/officeimo-word-wordheaderfooter/): Gets the fields contained in the header or footer.

Parameters

**item OfficeIMO.Word.WordField required**

The item.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Field(WordFieldType wordFieldType, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, Action<WordFieldScope>? configure = null)` [#](#method-field-officeimo-word-wordfieldtype-nullable-officeimo-word-wordfieldformat-string-boolean-action-officeimo-word-wordfieldscope)

Adds a field to the header or footer.

Parameters

**wordFieldType OfficeIMO.Word.WordFieldType required**

Type of field to insert.

**wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null optional**

Optional field format.

**customFormat string? = null optional**

Custom format string for date or time fields.

**advanced bool = false optional**

Whether to use advanced formatting.

**configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Field(WordFieldCode fieldCode, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, Action<WordFieldScope>? configure = null)` [#](#method-field-officeimo-word-wordfieldcode-nullable-officeimo-word-wordfieldformat-string-boolean-action-officeimo-word-wordfieldscope)

Inserts a field represented by a [WordFieldCode](/api/word/officeimo-word-wordfieldcode/).

Parameters

**fieldCode OfficeIMO.Word.WordFieldCode required**

Field code instance.

**wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null optional**

Optional field format.

**customFormat string? = null optional**

Custom format string for date or time fields.

**advanced bool = false optional**

Whether to use advanced formatting.

**configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Field(WordFieldBuilder builder, bool advanced = false, Action<WordFieldScope>? configure = null)` [#](#method-field-officeimo-word-wordfieldbuilder-boolean-action-officeimo-word-wordfieldscope)

Inserts a field constructed with [WordFieldBuilder](/api/word/officeimo-word-wordfieldbuilder/).

Parameters

**builder OfficeIMO.Word.WordFieldBuilder required**

Field builder instance.

**advanced bool = false optional**

Whether to use advanced formatting.

**configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Fields(IEnumerable<WordField> items)` [#](#method-fields-collections-generic-ienumerable-officeimo-word-wordfield)

Adds items to [WordHeaderFooter.Fields](/api/word/officeimo-word-wordheaderfooter/): Gets the fields contained in the header or footer.

Parameters

**items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordField> required**

The items, in order.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope HorizontalLine(WordBorderStyle? lineType = null, OfficeColor? color = null, uint size = 12, uint space = 1, Action<WordParagraphScope>? configure = null)` [#](#method-horizontalline-nullable-officeimo-word-wordborderstyle-nullable-officeimo-officecolor-uint32-uint32-action-officeimo-word-wordparagraphscope)

Adds a horizontal line to the header or footer.

Parameters

**lineType OfficeIMO.Word.WordBorderStyle? = null optional**

Border style of the line.

**color OfficeIMO.OfficeColor? = null optional**

Color of the line.

**size uint = 12 optional**

Thickness of the line.

**space uint = 1 optional**

Spacing above and below the line.

**configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

HyperLink 2 overloads

`public WordHeaderScope HyperLink(string text, Uri uri, bool addStyle = false, string tooltip = "", bool history = true, Action<WordHyperLinkScope>? configure = null)` [#](#method-hyperlink-string-uri-boolean-string-boolean-action-officeimo-word-wordhyperlinkscope)

Adds a hyperlink pointing to an external URI.

Parameters

**text string required**

Display text for the hyperlink.

**uri System.Uri required**

Destination URI.

**addStyle bool = false optional**

Whether to apply hyperlink style.

**tooltip string = "" optional**

Tooltip text for the link.

**history bool = true optional**

Whether to mark the link as visited.

**configure System.Action<OfficeIMO.Word.WordHyperLinkScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope HyperLink(string text, string anchor, bool addStyle = false, string tooltip = "", bool history = true, Action<WordHyperLinkScope>? configure = null)` [#](#method-hyperlink-string-string-boolean-string-boolean-action-officeimo-word-wordhyperlinkscope)

Adds an internal hyperlink to a bookmark within the document.

Parameters

**text string required**

Display text for the hyperlink.

**anchor string required**

Bookmark to link to.

**addStyle bool = false optional**

Whether to apply hyperlink style.

**tooltip string = "" optional**

Tooltip text for the link.

**history bool = true optional**

Whether to mark the link as visited.

**configure System.Action<OfficeIMO.Word.WordHyperLinkScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Image(string path, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null, Action<WordImageScope>? configure = null)` [#](#method-image-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-word-wordimageoptions-action-officeimo-word-wordimagescope)

Adds an image to the header.

Parameters

**path string required**

The value.

**width OfficeIMO.OfficeLength? = null optional**

The value.

**height OfficeIMO.OfficeLength? = null optional**

The value.

**options OfficeIMO.Word.WordImageOptions? = null optional**

The value.

**configure System.Action<OfficeIMO.Word.WordImageScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope List(WordListStyle style, Action<WordListScope>? configure = null)` [#](#method-list-officeimo-word-wordliststyle-action-officeimo-word-wordlistscope)

Creates a list with the specified style.

Parameters

**style OfficeIMO.Word.WordListStyle required**

List style to apply.

**configure System.Action<OfficeIMO.Word.WordListScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

PageNumber 2 overloads

`public WordHeaderScope PageNumber(WordPageNumberStyle wordPageNumberStyle, Action<WordPageNumberScope>? configure = null)` [#](#method-pagenumber-officeimo-word-wordpagenumberstyle-action-officeimo-word-wordpagenumberscope)

Adds a page number field to the header.

Parameters

**wordPageNumberStyle OfficeIMO.Word.WordPageNumberStyle required**

The numbering style to apply.

**configure System.Action<OfficeIMO.Word.WordPageNumberScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope PageNumber(bool includeTotalPages = false, WordFieldFormat? format = null, string separator = " of ", Action<WordParagraphScope>? configure = null)` [#](#method-pagenumber-boolean-nullable-officeimo-word-wordfieldformat-string-action-officeimo-word-wordparagraphscope)

Inserts a page number field.

Parameters

**includeTotalPages bool = false optional**

Include total pages in the display.

**format OfficeIMO.Word.WordFieldFormat? = null optional**

Optional number format.

**separator string = " of " optional**

Separator used when total pages are included.

**configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

Paragraph 3 overloads

`public WordHeaderScope Paragraph(Action<WordParagraphScope> configure)` [#](#method-paragraph-action-officeimo-word-wordparagraphscope)

[WordScopes.cs:102](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/Sources/OfficeIMO.Word/Scopes/WordScopes.cs#L102)

Adds a paragraph to the header and composes it.

Parameters

**configure System.Action<OfficeIMO.Word.WordParagraphScope> required**

Adds text runs and formats the paragraph.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Paragraph(WordParagraph item)` [#](#method-paragraph-officeimo-word-wordparagraph)

Adds an item to [WordHeaderFooter.Paragraphs](/api/word/officeimo-word-wordheaderfooter/): Gets all paragraphs contained in the header or footer.

Parameters

**item OfficeIMO.Word.WordParagraph required**

The item.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Paragraph(string text, Action<WordParagraphScope>? configure = null)` [#](#method-paragraph-string-action-officeimo-word-wordparagraphscope)

Adds a new paragraph with the specified text to the header or footer.

Parameters

**text string required**

Paragraph text.

**configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Paragraphs(IEnumerable<WordParagraph> items)` [#](#method-paragraphs-collections-generic-ienumerable-officeimo-word-wordparagraph)

Adds items to [WordHeaderFooter.Paragraphs](/api/word/officeimo-word-wordheaderfooter/): Gets all paragraphs contained in the header or footer.

Parameters

**items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordParagraph> required**

The items, in order.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Shape(WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null, OfficeColor? strokeColor = null, OfficeLength? strokeWeight = null, double arcSize = 0.25, Action<WordShapeScope>? configure = null)` [#](#member-6ece5e52741d190c10fa06dc)

Adds a VML shape to the header.

Parameters

**shapeType OfficeIMO.Word.WordShapeType required**

Type of shape to create.

**width OfficeIMO.OfficeLength required**

Width or line end X.

**height OfficeIMO.OfficeLength required**

Height or line end Y.

**fillColor OfficeIMO.OfficeColor? = null optional**

Fill color; white when omitted.

**strokeColor OfficeIMO.OfficeColor? = null optional**

Stroke color; black when omitted.

**strokeWeight OfficeIMO.OfficeLength? = null optional**

Stroke thickness; one point when omitted.

**arcSize double = 0.25 optional**

Corner roundness fraction for rounded rectangles.

**configure System.Action<OfficeIMO.Word.WordShapeScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

Table 2 overloads

`public WordHeaderScope Table(Action<WordTableBuilder> compose)` [#](#method-table-action-officeimo-word-wordtablebuilder)

[WordScopes.cs:111](https://github.com/EvotecIT/OfficeIMO/blob/105ae88c45f6be3bb2020384e25ffe61d990451b/Sources/OfficeIMO.Word/Scopes/WordScopes.cs#L111)

Adds a table composed row by row to the header.

Parameters

**compose System.Action<OfficeIMO.Word.WordTableBuilder> required**

Sets the columns, header row and rows.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Table(int rows, int columns, WordTableStyle tableStyle = TableGrid, Action<WordTableScope>? configure = null)` [#](#method-table-int32-int32-officeimo-word-wordtablestyle-action-officeimo-word-wordtablescope)

Creates a table and appends it to the header or footer.

Parameters

**rows int required**

Number of rows.

**columns int required**

Number of columns.

**tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optional**

Table style to apply.

**configure System.Action<OfficeIMO.Word.WordTableScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope TextBox(string text, WordImageTextWrapping wrapTextImage = Square, Action<WordTextBoxScope>? configure = null)` [#](#method-textbox-string-officeimo-word-wordimagetextwrapping-action-officeimo-word-wordtextboxscope)

Adds a text box to the header.

Parameters

**text string required**

Text contained in the text box.

**wrapTextImage OfficeIMO.Word.WordImageTextWrapping = Square optional**

Wrapping style.

**configure System.Action<OfficeIMO.Word.WordTextBoxScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

`public WordHeaderScope Watermark(WordWatermarkStyle watermarkStyle, string textOrFilePath, OfficeLength? horizontalOffset = null, OfficeLength? verticalOffset = null, double scale = 1, Action<WordWatermarkScope>? configure = null)` [#](#method-watermark-officeimo-word-wordwatermarkstyle-string-nullable-officeimo-officelength-nullable-officeimo-officelength-double-action-officeimo-word-wordwatermarkscope)

Adds a watermark to the header.

Parameters

**watermarkStyle OfficeIMO.Word.WordWatermarkStyle required**

Watermark style.

**textOrFilePath string required**

Text or image path for the watermark.

**horizontalOffset OfficeIMO.OfficeLength? = null optional**

Optional signed horizontal offset.

**verticalOffset OfficeIMO.OfficeLength? = null optional**

Optional signed vertical offset.

**scale double = 1 optional**

Scale factor for width and height.

**configure System.Action<OfficeIMO.Word.WordWatermarkScope>? = null optional**

Configures the new item through its scope.

Returns

`WordHeaderScope` The same scope.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public WordHeader Model { get; }` [#](#property-model)

The [WordHeader](/api/word/officeimo-word-wordheader/) this scope edits, for plain C# inside a lambda.

<!-- PowerForge markdown artifact sha256:62A5FD99D34A21E10AE50965A6ED2BC8155CF1D002D7E064523D13D19D282D95 -->
