Skip to main content
Row

WorksheetHeaderFooter Interface

A worksheet header or footer.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v23.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface WorksheetHeaderFooter

Remarks

Use the Worksheet.HeaderFooterOptions property to access header and footer options for a worksheet.

The WorksheetHeaderFooter.FromString and WorksheetHeaderFooter.FromLCR methods enable you to specify header and footer content. You can use special codes to add dynamic data to a header or footer, and format its content. These codes are also available as constant fields and static methods of the HeaderFooterCode class.

The following example shows how to specify the header and footer for the first page.

SpreadsheetControl_HeaderFooterPrintPreview

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");
See Also