Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordHeaderFooter

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
0eef6a5756b9 with working tree changes

Represents the shared functionality for headers and footers and exposes their content through various collections.

Inheritance

  • object
  • WordHeaderFooter

Derived Types

Usage

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

Accepted by parameters 2

Constructors

public WordHeaderFooter() #

Methods

public WordBookmark AddBookmark(string bookmarkName) #

Adds a bookmark at the current location.

Parameters

bookmarkName string required
Name of the bookmark.

Returns

WordBookmark The created WordBookmark.
AddField 3 overloads
public WordField AddField(WordFieldType wordFieldType, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false) #

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.

Returns

WordField The created WordField.
public WordField AddField(WordFieldCode fieldCode, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false) #

Inserts a field represented by a 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.

Returns

WordField The created WordField.
public WordField AddField(WordFieldBuilder builder, bool advanced = false) #

Inserts a field constructed with WordFieldBuilder.

Parameters

builder OfficeIMO.Word.WordFieldBuilder required
Field builder instance.
advanced bool = false optional
Whether to use advanced formatting.

Returns

WordField The created WordField.
public WordParagraph AddHorizontalLine(WordBorderStyle? lineType = null, OfficeColor? color = null, uint size = 12, uint space = 1) #

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.

Returns

WordParagraph The created WordParagraph instance.
AddHyperLink 2 overloads
public WordList AddList(WordListStyle style) #

Creates a list with the specified style.

Parameters

style OfficeIMO.Word.WordListStyle required
List style to apply.

Returns

WordList The created WordList.
public WordParagraph AddPageNumber(bool includeTotalPages = false, WordFieldFormat? format = null, string separator = " of ") #

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.

Returns

WordParagraph The created WordParagraph instance.
AddParagraph 2 overloads
public WordParagraph AddParagraph(string text) #

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

Parameters

text string required
Paragraph text.

Returns

WordParagraph The created WordParagraph instance.
public WordParagraph AddParagraph(bool newRun = false) #

Creates an empty paragraph and appends it to the header or footer.

Parameters

newRun bool = false optional
Specifies whether a new run should be started.

Returns

WordParagraph The created WordParagraph instance.
public WordTable AddTable(int rows, int columns, WordTableStyle tableStyle = TableGrid) #

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.

Returns

WordTable The created WordTable.

Properties

public List<WordParagraph> Paragraphs { get; } #

Gets all paragraphs contained in the header or footer.

public List<WordElement> Elements { get; } #

Gets the direct child elements contained in the header or footer in document order.

public List<WordTable> Tables { get; } #

Gets all tables contained in the header or footer.

public List<WordTextBox> TextBoxes { get; } #

Gets all text boxes contained in the header or footer.

public List<WordParagraph> ParagraphsPageBreaks { get; } #

Gets paragraphs that contain a page break.

public List<WordParagraph> ParagraphsFields { get; } #

Gets paragraphs that contain a field.

public List<WordParagraph> ParagraphsBookmarks { get; } #

Gets paragraphs that contain a bookmark.

public List<WordParagraph> ParagraphsEquations { get; } #

Gets paragraphs that contain an equation.

public List<WordParagraph> ParagraphsStructuredDocumentTags { get; } #

Provides a list of paragraphs that contain Structured Document Tags

public List<WordParagraph> ParagraphsCheckBoxes { get; } #

Gets paragraphs that contain a check box.

public List<WordParagraph> ParagraphsDatePickers { get; } #

Gets paragraphs that contain a date picker control.

public List<WordParagraph> ParagraphsDropDownLists { get; } #

Gets paragraphs that contain a dropdown list control.

public List<WordParagraph> ParagraphsRepeatingSections { get; } #

Gets paragraphs that contain a repeating section control.

public List<WordParagraph> ParagraphsImages { get; } #

Provides a list of paragraphs that contain Image

public List<WordParagraph> ParagraphsSmartArts { get; } #

Provides a list of paragraphs that contain SmartArt diagrams.

public List<WordBreak> PageBreaks { get; } #

Gets the page breaks contained in the header or footer.

public List<WordImage> Images { get; } #

Exposes Images in their Image form for easy access (saving, modifying)

public List<WordSmartArt> SmartArts { get; } #

Gets the SmartArt diagrams contained in the header or footer.

public List<WordBookmark> Bookmarks { get; } #

Gets the bookmarks contained in the header or footer.

public List<WordField> Fields { get; } #

Gets the fields contained in the header or footer.

public List<WordEquation> Equations { get; } #

Gets the equations contained in the header or footer.

public List<WordStructuredDocumentTag> StructuredDocumentTags { get; } #

Gets the structured document tags contained in the header or footer.

public List<WordCheckBox> CheckBoxes { get; } #

Gets the check boxes contained in the header or footer.

public List<WordDatePicker> DatePickers { get; } #

Gets the date pickers contained in the header or footer.

public List<WordDropDownList> DropDownLists { get; } #

Gets the dropdown lists contained in the header or footer.

public List<WordRepeatingSection> RepeatingSections { get; } #

Gets the repeating sections contained in the header or footer.

public List<WordWatermark> Watermarks { get; } #

Gets the watermarks contained in the header or footer.