# ExcelHeaderFooterSection

A left, center or right section of a header or footer: text with Excel codes, and an optional picture.

Class 

`OfficeIMO.Excel`

**Namespace**

`OfficeIMO.Excel`

**Assembly**

`OfficeIMO.Excel`

**Source revision**

`7fbbd72e7c5a` with working tree changes

**Source**

[ExcelSheetPageSetup.cs:293](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L293)

**Modifiers**

sealed

A left, center or right section of a header or footer: text with Excel codes, and an optional picture.

## Inheritance

- object
- ExcelHeaderFooterSection

## Usage

Explore 3 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 3

- Property [ExcelHeaderFooter.Center](/api/excel/officeimo-excel-excelheaderfooter/#property-center)
- Property [ExcelHeaderFooter.Left](/api/excel/officeimo-excel-excelheaderfooter/#property-left)
- Property [ExcelHeaderFooter.Right](/api/excel/officeimo-excel-excelheaderfooter/#property-right)

Filter members 

Show inherited

## Methods

`public void SetImage(byte[] imageBytes, string contentType = "image/png", OfficeLength? width = null, OfficeLength? height = null)` [#](#method-setimage-byte-string-nullable-officeimo-officelength-nullable-officeimo-officelength)

[ExcelSheetPageSetup.cs:293](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L293)

Sets the section picture and adds the &G placeholder to its text.

Parameters

**imageBytes byte[] required**

Image bytes.

**contentType string = "image/png" optional**

Image content type, such as image/png or image/jpeg.

**width OfficeIMO.OfficeLength? = null optional**

Optional physical width; inferred from the image when omitted.

**height OfficeIMO.OfficeLength? = null optional**

Optional physical height; inferred from the image when omitted.

Exceptions

- `NotSupportedException` – The section belongs to a first-page or even-page variant.

SetImageFromUrlAsync 2 overloads

`public Task SetImageFromUrlAsync(string url, OfficeLength? width = null, OfficeLength? height = null, CancellationToken cancellationToken = default)` [#](#method-setimagefromurlasync-string-nullable-officeimo-officelength-nullable-officeimo-officelength-threading-cancellationtoken)

[ExcelSheetPageSetup.cs:299](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L299)

Downloads an image and sets it as the section picture.

Parameters

**url string required**

**width OfficeIMO.OfficeLength? = null optional**

**height OfficeIMO.OfficeLength? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task`

`public Task SetImageFromUrlAsync(string url, OfficeRemoteImageLoadOptions remoteImageOptions, OfficeLength? width = null, OfficeLength? height = null, CancellationToken cancellationToken = default)` [#](#method-setimagefromurlasync-string-officeimo-drawing-officeremoteimageloadoptions-nullable-officeimo-officelength-nullable-officeimo-officelength-threading-cancellationtoken)

[ExcelSheetPageSetup.cs:304](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L304)

Downloads an image under an explicit remote-network policy and sets it as the section picture.

Parameters

**url string required**

**remoteImageOptions OfficeIMO.Drawing.OfficeRemoteImageLoadOptions required**

**width OfficeIMO.OfficeLength? = null optional**

**height OfficeIMO.OfficeLength? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public ExcelHeaderFooterPosition Position { get; }` [#](#property-position)

[ExcelSheetPageSetup.cs:272](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L272)

Which section this is.

`public string Text { get; set; }` [#](#property-text)

[ExcelSheetPageSetup.cs:279](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L279)

Section text. Excel codes such as &P (page), &N (pages), &D (date), &A (sheet name) and &G (picture) are kept; other ampersands are written literally. An empty string clears the section.

`public ExcelHeaderFooterImageInfo? Image { get; }` [#](#property-image)

[ExcelSheetPageSetup.cs:284](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Excel/ExcelSheetPageSetup.cs#L284)

The section picture; null when it has none. Pictures are supported in the running header and footer.

<!-- PowerForge markdown artifact sha256:6F86FA3241418791BC1A32D148A962FE7A946736CA717F5576C45D1016CD8E77 -->
