ExcelFile.PageHeader Property
Page header on the active sheet. Note that this property sets the same header for the all the pages. In Excel 2007 or newer you can set a different header for the first page, or odd/even pages. If you want to control these options, see GetPageHeaderAndFooter and SetPageHeaderAndFooter.
A page header is a string that contains the text for the 3 parts of the header.
The Left section begins with &L, the Center section with &C and the Right with &R
For example, the text"<his goes at the left!&CThis is centered!&RThis is right aligned" will write text to all the sections.
This is the full list of macros you can include:
- && The "&" character itself
- &L Start of the left section
- &C Start of the centered section
- &R Start of the right section
- &P Current page number
- &N Page count
- &D Current date
- &T Current time
- &A Sheet name
- &F File name without path
- &Z File path without file name (XP or Newer)
- &G Picture (XP or Newer)
- &U Underlining on/off
- &E Double underlining on/off
- &S Strikeout on/off
- &X Superscript on/off
- &Y Subscript on/off
- &"<fontname>" Set new font <fontname>
- &"<fontname>,<fontstyle>" Set new font with specified style <fontstyle>. The style <fontstyle> is in most cases one of "Regular", "Bold", "Italic", or "Bold Italic". But this setting is dependent on the used font, it may differ (localized style names, or "Standard", "Oblique", ...).
- &<fontheight> Set font height in points (<fontheight> is a decimal value). If this command is followed by a plain number to be printed in the header, it will be separated from the font height with a space character.
- &K<fontcolor> Set the font color. Font color can be either specified as a RRGGBB hexadecimal number, like &KFF0000 for red, or as a theme color with "TH-TINT" like &K08-024. For a theme, the first 2 digits before the "-" sign are the number that corresponds with the TPrimaryThemeColor, and the other numbers are the tint of the theme.
Normally, the easiest way to find out which header string you need is to create an xls file on Excel, add a header, open the file with FlexCel and take a look at the generated header (You can use the ApiMate tool for that).
Syntax
Namespace: FlexCel.Core
public abstract String PageHeader { get; set; }