officefileapi-devexpress-dot-spreadsheet-3453ad2b.md
Contains format codes used in headers and footers.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public static class HeaderFooterCode
Public Module HeaderFooterCode
Use special codes returned by the HeaderFooterCode class members to add dynamic data to a header or footer, and format its content.
The example below shows how to specify the header and footer for the first page.
WorksheetHeaderFooterOptions options = worksheet.HeaderFooterOptions;
// Specify that the first page has a unique header and footer.
options.DifferentFirst = true;
// Insert the rich formatted text into the header's left section.
options.FirstHeader.Left = string.Format("{0}&BDev{1}AV", HeaderFooterCode.FontColor(4, -50), HeaderFooterCode.FontColor(4,10));
// Insert the sheet name into the header's right section.
options.FirstHeader.Right = "&A";
// Insert the current date into the footer's left section.
options.FirstFooter.Left = "&D";
// Insert the current page number into the footer's right section.
options.FirstFooter.Right = string.Format("Page {0} of {1}", "&P", "&N");
Dim options As WorksheetHeaderFooterOptions = worksheet.HeaderFooterOptions
' Specify that the first page has a unique header and footer.
options.DifferentFirst = True
' Insert the rich formatted text into the header's left section.
options.FirstHeader.Left = String.Format("{0}&BDev{1}AV", HeaderFooterCode.FontColor(4, -50), HeaderFooterCode.FontColor(4,10))
' Insert the sheet name into the header's right section.
options.FirstHeader.Right = "&A"
' Insert the current date into the footer's left section.
options.FirstFooter.Left = "&D"
' Insert the current page number into the footer's right section.
options.FirstFooter.Right = String.Format("Page {0} of {1}", "&P", "&N")
Object HeaderFooterCode
See Also