Skip to main content
Row

HeaderFooterPicture Interface

A picture embedded in a worksheet header or footer.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface HeaderFooterPicture

Remarks

Use the Worksheet.HeaderFooterOptions property to add headers and footers to printed pages.

Properties

Description

WorksheetHeaderFooterOptions.FirstHeader,

WorksheetHeaderFooterOptions.FirstFooter

Define a header and footer for the first page.

WorksheetHeaderFooterOptions.OddHeader,

WorksheetHeaderFooterOptions.OddFooter

Define headers and footers for odd pages.

WorksheetHeaderFooterOptions.EvenHeader,

WorksheetHeaderFooterOptions.EvenFooter

Define headers and footers for even pages.

Use the WorksheetHeaderFooter.AddPicture method to insert a picture into a header or footer.

SpreadsheetControl_HeaderFooterPrintPreview

// Set measurement unit to inches.
workbook.Unit = DevExpress.Office.DocumentUnit.Inch;
// Access header and footer options.
WorksheetHeaderFooterOptions options = worksheet.HeaderFooterOptions;
// Specify that the first page has a unique header and footer.
options.DifferentFirst = true;

// Insert a picture in the center of the footer.
options.FirstFooter.AddPicture("DxLogo.png", HeaderFooterSection.Center);

// Add an inline picture to the header's left section.
HeaderFooterPicture picture = options.FirstHeader.AddPicture(SpreadsheetImageSource.FromFile("DevAvLogo.png"), HeaderFooterSection.Left);
// Use the &G code to specify the picture position within text.
options.FirstHeader.Left = string.Format("{0}&BDev{1}AV &G", 
    HeaderFooterCode.FontColor(Color.FromArgb(0x05, 0x6f, 0xCE)), HeaderFooterCode.FontColor(Color.FromArgb(0x39, 0xA6, 0xF7)));
// Specify the picture size in inches.
picture.Height = 0.3f;
picture.Width = 0.3f;

Note

Call the WorksheetHeaderFooter.AddPicture method before you use the &G code to insert an inline picture into a header or footer. System.InvalidOperationException occurs when the Spreadsheet cannot find the picture.

See Also