API Reference
WordHeaderFooter
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) #WordParagraphAdds a bookmark at the current location.
Parameters
- bookmarkName System.String
- Name of the bookmark.
Returns
The created WordParagraph instance.
public WordParagraph AddField(WordFieldCode fieldCode, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false) #WordParagraphAdds a field to the header or footer.
Parameters
- wordFieldType OfficeIMO.Word.WordFieldType
- Type of field to insert.
- wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional field format.
- customFormat System.String = null
- Custom format string for date or time fields.
- advanced System.Boolean = false
- 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
- Field code instance.
- wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat}
- Optional field format.
- customFormat System.String
- Custom format string for date or time fields.
- advanced System.Boolean
- Whether to use advanced formatting.
Returns
The created WordParagraph instance.
public WordParagraph AddField(WordFieldBuilder builder, Boolean advanced = false) #WordParagraphInserts a field constructed with WordFieldBuilder.
Parameters
- builder OfficeIMO.Word.WordFieldBuilder
- Field builder instance.
- advanced System.Boolean = false
- 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) #WordParagraphAdds a horizontal line to the header or footer.
Parameters
- lineType System.Nullable{DocumentFormat.OpenXml.Wordprocessing.BorderValues} = null
- Border style of the line.
- color System.Nullable{SixLabors.ImageSharp.Color} = null
- Color of the line.
- size System.UInt32 = 12
- Thickness of the line.
- space System.UInt32 = 1
- Spacing above and below the line.
Returns
The created WordParagraph instance.
public WordParagraph AddHyperLink(String text, Uri uri, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdds a hyperlink pointing to an external URI.
Parameters
- text System.String
- Display text for the hyperlink.
- uri System.Uri
- Destination URI.
- addStyle System.Boolean = false
- Whether to apply hyperlink style.
- tooltip System.String = ""
- Tooltip text for the link.
- history System.Boolean = true
- Whether to mark the link as visited.
Returns
The created WordParagraph instance.
public WordParagraph AddHyperLink(String text, String anchor, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdds an internal hyperlink to a bookmark within the document.
Parameters
- text System.String
- Display text for the hyperlink.
- anchor System.String
- Bookmark to link to.
- addStyle System.Boolean = false
- Whether to apply hyperlink style.
- tooltip System.String = ""
- Tooltip text for the link.
- history System.Boolean = true
- Whether to mark the link as visited.
Returns
The created WordParagraph instance.
public WordList AddList(WordListStyle style) #WordListCreates a list with the specified style.
Parameters
- style OfficeIMO.Word.WordListStyle
- List style to apply.
Returns
The created WordList.
public WordParagraph AddPageNumber(Boolean includeTotalPages = false, Nullable<WordFieldFormat> format = null, String separator = " of ") #WordParagraphInserts a page number field.
Parameters
- includeTotalPages System.Boolean = false
- Include total pages in the display.
- format System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional number format.
- separator System.String = " of "
- Separator used when total pages are included.
Returns
The created WordParagraph instance.
public WordParagraph AddParagraph(String text) #WordParagraphAdds a new paragraph with the specified text to the header or footer.
Parameters
- text System.String
- Paragraph text.
Returns
The created WordParagraph instance.
public WordParagraph AddParagraph(Boolean newRun = false) #WordParagraphCreates an empty paragraph and appends it to the header or footer.
Parameters
- newRun System.Boolean = false
- Specifies whether a new run should be started.
Returns
The created WordParagraph instance.
public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #WordTableCreates a table and appends it to the header or footer.
Parameters
- rows System.Int32
- Number of rows.
- columns System.Int32
- Number of columns.
- tableStyle OfficeIMO.Word.WordTableStyle = TableGrid
- Table style to apply.
Returns
The created WordTable.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
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> ParagraphsHyperLinks { get; } #Gets paragraphs that contain a hyperlink.
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<WordHyperLink> HyperLinks { get; } #Gets the hyperlinks 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.