Version

Header Property (PrintOptionsBase)

Gets or sets the header for each page of the printed worksheet.
Syntax
public string Header {get; set;}

Property Value

The header for each page of the worksheet.
Remarks

The '&' character in the header and footer is a special character. Depending on what is after it, the formatting of the text can be controlled or dynamic text can be inserted. Below is a list of the available commands:

Section commands
&L The following text will appear in the left section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section.
&C The following text will appear in the center section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section.
&R The following text will appear in the right section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section.
Replacement commands
&& Insert the '&' character.
&A Insert the current worksheet name.
&D Insert the current date.
&F Insert the current file name.
&G Insert an image (Note: This command is currently not supported).
&N Insert the number of pages the worksheet will need to print.
&P Insert the current page number.
&T Insert the current time.
&Z Insert the current file path (without the file name).
Formatting commands
&B Toggle bold.
&E Toggle double underlining.
&I Toggle italics.
&S Toggle strikethrough.
&U Toggle underlining.
&X Toggle superscript.
&Y Toggle subscript.
&<FontSize> Sets a new font size for the following text. The size is expressed as a positive integer. If a number is to follow this command in the header, it must be separated by a space.
&"<FontName>" Sets a new font for the following text. If the font name is not recognized, the default font will be used.
&"<FontName>,<FontStyle>" Sets the new font and font style for the following text. The font style is usually "Regular", "Bold", "Italic", or "Bold Italic", but can be other styles depending on the font. The available font styles can be seen in the font dialog when a font is selected.

The header or footer string could look like this: &L&"Arial,Bold"&D&CPage &P of &N on &A&R&14&F.

Requirements

Target Platforms: Android 4.4+, iOS 8+

Development Environments: Visual Studio 2015+, Visual Studio for Mac Preview, Xamarin for Visual Studio 4.2+

See Also