Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelHeaderFooterSection

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
e163ccb36643 with working tree changes
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

Methods

public void SetImage(byte[] imageBytes, string contentType = "image/png", OfficeLength? width = null, OfficeLength? height = null) #

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) #

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) #

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

Properties

public ExcelHeaderFooterPosition Position { get; } #

Which section this is.

public string Text { get; set; } #

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; } #

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