OfficeIMO

API Reference

Class

WordHeaderFooter

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents the shared functionality for headers and footers and provides methods to manipulate their content.

Inheritance

  • Object
  • WordHeaderFooter

Constructors

public WordHeaderFooter() #

Methods

public WordParagraph AddBookmark(String bookmarkName) #
Returns: WordParagraph

Adds a bookmark at the current location.

Parameters

bookmarkName System.String requiredposition: 0
Name of the bookmark.

Returns

The created WordParagraph instance.

AddField 3 overloads
public WordParagraph AddField(WordFieldCode fieldCode, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false) #
Returns: WordParagraph

Adds a field to the header or footer.

Parameters

wordFieldType OfficeIMO.Word.WordFieldType requiredposition: 0
Type of field to insert.
wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null optionalposition: 1
Optional field format.
customFormat System.String = null optionalposition: 2
Custom format string for date or time fields.
advanced System.Boolean = false optionalposition: 3
Whether to use advanced formatting.

Returns

The created WordParagraph instance.

AddField(OfficeIMO.Word.WordFieldCode fieldCode, System.Nullable{OfficeIMO.Word.WordFieldFormat} wordFieldFormat, System.String customFormat, System.Boolean advanced) #

Inserts a field represented by a WordFieldCode.

Parameters

fieldCode OfficeIMO.Word.WordFieldCode required
Field code instance.
wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} required
Optional field format.
customFormat System.String required
Custom format string for date or time fields.
advanced System.Boolean required
Whether to use advanced formatting.

Returns

The created WordParagraph instance.

public WordParagraph AddField(WordFieldBuilder builder, Boolean advanced = false) #
Returns: WordParagraph

Inserts a field constructed with WordFieldBuilder.

Parameters

builder OfficeIMO.Word.WordFieldBuilder requiredposition: 0
Field builder instance.
advanced System.Boolean = false optionalposition: 1
Whether to use advanced formatting.

Returns

The created WordParagraph instance.

public WordParagraph AddHorizontalLine(Nullable<BorderValues> lineType = null, Nullable<Color> color = null, UInt32 size = 12, UInt32 space = 1) #
Returns: WordParagraph

Adds a horizontal line to the header or footer.

Parameters

lineType System.Nullable{DocumentFormat.OpenXml.Wordprocessing.BorderValues} = null optionalposition: 0
Border style of the line.
color System.Nullable{SixLabors.ImageSharp.Color} = null optionalposition: 1
Color of the line.
size System.UInt32 = 12 optionalposition: 2
Thickness of the line.
space System.UInt32 = 1 optionalposition: 3
Spacing above and below the line.

Returns

The created WordParagraph instance.

AddHyperLink 2 overloads
public WordList AddList(WordListStyle style) #
Returns: WordList

Creates a list with the specified style.

Parameters

style OfficeIMO.Word.WordListStyle requiredposition: 0
List style to apply.

Returns

The created WordList.

public WordParagraph AddPageNumber(Boolean includeTotalPages = false, Nullable<WordFieldFormat> format = null, String separator = " of ") #
Returns: WordParagraph

Inserts a page number field.

Parameters

includeTotalPages System.Boolean = false optionalposition: 0
Include total pages in the display.
format System.Nullable{OfficeIMO.Word.WordFieldFormat} = null optionalposition: 1
Optional number format.
separator System.String = " of " optionalposition: 2
Separator used when total pages are included.

Returns

The created WordParagraph instance.

AddParagraph 2 overloads
public WordParagraph AddParagraph(String text) #
Returns: WordParagraph

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

Parameters

text System.String requiredposition: 0
Paragraph text.

Returns

The created WordParagraph instance.

public WordParagraph AddParagraph(Boolean newRun = false) #
Returns: WordParagraph

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

Parameters

newRun System.Boolean = false optionalposition: 0
Specifies whether a new run should be started.

Returns

The created WordParagraph instance.

public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #
Returns: WordTable

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

Parameters

rows System.Int32 requiredposition: 0
Number of rows.
columns System.Int32 requiredposition: 1
Number of columns.
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optionalposition: 2
Table style to apply.

Returns

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.

Fields

_header #

Underlying OpenXML header element associated with this header or footer.

_document #

Parent WordDocument instance this header or footer belongs to.