ComponentOne Excel for .NET
C1.Excel Assembly / C1.Excel Namespace / XLPrintSettings Class / Header Property
Example

In This Topic
    Header Property
    In This Topic
    Gets or sets the string to be displayed as a page header when the sheet is printed.
    Syntax
    'Declaration
     
    Public Property Header As System.String
    public System.string Header {get; set;}
    Remarks

    The header string may contain special commands, i.e. placeholders for the page number, current date, or text formatting attributes. Most of these fields are represented by single letters with a leading ampersand ("&").

    The page header is divided into 3 sections: left, center, and right. Each section is introduced by a special command ("&L", "&C", and "&R"). All text and all commands following are part of the selected section.

    The following commands are available:

    &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

    &G Picture (file name)

    &B Bold toggle

    &I Italic toggle

    &U Underline toggle

    &E Double underline toggle

    &S Strikeout toggle

    &X Superscript toggle

    &Y Subscript toggle

    &"[FontName]" Set new font

    &"[FontName,FontStyle]" Set new font with specified style. The style is in most cases "Regular", "Bold", "Italic", or "Bold Italic".

    &[fontheight] Set font height in points.
    Example
    The code below creates a header with left, center, and right portions.
    PrintSettings ps = sheet.PrintSettings;
    ps.Header = "&LHeader Left&CHeader Center&RHeader Right";
    See Also