'Declaration Public Property Header As System.String
public System.string Header {get; set;}
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.
Target Platforms: Windows 8.1, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
View on GitHub