Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordHeader

OfficeIMO.Word

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

Represents a single header instance within a section.

Inheritance

Usage

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

Methods

public WordImage AddImage(string path, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null) #

Adds an image to the header.

Parameters

path string required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
options OfficeIMO.Word.WordImageOptions? = null optional

Returns

WordImage
public WordPageNumber AddPageNumber(WordPageNumberStyle wordPageNumberStyle) #

Adds a page number field to the header.

Parameters

wordPageNumberStyle OfficeIMO.Word.WordPageNumberStyle required
The numbering style to apply.

Returns

WordPageNumber The created WordPageNumber.
public WordShape AddShape(WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null, OfficeColor? strokeColor = null, OfficeLength? strokeWeight = null, double arcSize = 0.25) #

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.

Returns

WordShape
public WordShape AddShapeDrawing(WordShapeType shapeType, OfficeLength width, OfficeLength height) #

Adds a DrawingML shape to the header.

Parameters

shapeType OfficeIMO.Word.WordShapeType required
Type of shape to create.
width OfficeIMO.OfficeLength required
Width.
height OfficeIMO.OfficeLength required
Height.

Returns

WordShape
public WordTextBox AddTextBox(string text, WordImageTextWrapping wrapTextImage = Square) #

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.

Returns

WordTextBox The created WordTextBox.
public WordTextBox AddTextBoxVml(string text) #

Adds a VML text box to the header.

Parameters

text string required
public WordWatermark AddWatermark(WordWatermarkStyle watermarkStyle, string textOrFilePath, OfficeLength? horizontalOffset = null, OfficeLength? verticalOffset = null, double scale = 1) #

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.

Returns

WordWatermark The created WordWatermark.
public static void RemoveHeaders(WordDocument document, params WordHeaderFooterType[] types) #

Removes headers from the specified WordDocument. When no types are provided all headers are removed.

Parameters

document OfficeIMO.Word.WordDocument required
Document to operate on.
types OfficeIMO.Word.WordHeaderFooterType[] required
Header types to remove.