# ExcelTemplateImage

Image value that can be bound to a whole-cell template marker.

Class 

`OfficeIMO.Excel`

**Namespace**

`OfficeIMO.Excel`

**Assembly**

`OfficeIMO.Excel`

**Source revision**

`273d35d5ba8a` with working tree changes

**Source**

[ExcelTemplate.cs:111](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L111)

**Modifiers**

sealed

Image value that can be bound to a whole-cell template marker.

## Inheritance

- object
- ExcelTemplateImage

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

- Method [ExcelTemplateImage.FromBytes](/api/excel/officeimo-excel-exceltemplateimage/#method-frombytes-byte-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean)
- Method [ExcelTemplateImage.FromStream](/api/excel/officeimo-excel-exceltemplateimage/#method-fromstream-io-stream-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean)
- Method [ExcelTemplateImage.FromUrlAsync](/api/excel/officeimo-excel-exceltemplateimage/#method-fromurlasync-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean-threading-cancellationtoken)

Filter members 

Show inherited

## Methods

`public static ExcelTemplateImage FromBytes(byte[] bytes, string contentType = "image/png", OfficeLength? width = null, OfficeLength? height = null, OfficeLength offsetX = default, OfficeLength offsetY = default, string? name = null, string? altText = null, bool lockAspectRatio = true)` [#](#method-frombytes-byte-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean)

[ExcelTemplate.cs:111](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L111)

Creates a template image from bytes.

Parameters

**bytes byte[] required**

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

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

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

**offsetX OfficeIMO.OfficeLength = default optional**

**offsetY OfficeIMO.OfficeLength = default optional**

**name string? = null optional**

**altText string? = null optional**

**lockAspectRatio bool = true optional**

Returns

`ExcelTemplateImage`

`public static ExcelTemplateImage FromStream(Stream stream, string contentType = "image/png", OfficeLength? width = null, OfficeLength? height = null, OfficeLength offsetX = default, OfficeLength offsetY = default, string? name = null, string? altText = null, bool lockAspectRatio = true)` [#](#method-fromstream-io-stream-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean)

[ExcelTemplate.cs:119](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L119)

Creates a template image from a stream.

Parameters

**stream System.IO.Stream required**

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

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

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

**offsetX OfficeIMO.OfficeLength = default optional**

**offsetY OfficeIMO.OfficeLength = default optional**

**name string? = null optional**

**altText string? = null optional**

**lockAspectRatio bool = true optional**

Returns

`ExcelTemplateImage`

FromUrlAsync 2 overloads

`public static async Task<ExcelTemplateImage> FromUrlAsync(string url, OfficeLength? width = null, OfficeLength? height = null, OfficeLength offsetX = default, OfficeLength offsetY = default, string? name = null, string? altText = null, bool lockAspectRatio = true, CancellationToken cancellationToken = default)` [#](#method-fromurlasync-string-nullable-officeimo-officelength-nullable-officeimo-officelength-officeimo-officelength-officeimo-officelength-string-string-boolean-threading-cancellationtoken)

Asynchronously creates a template image from a remote URL.

Parameters

**url string required**

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

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

**offsetX OfficeIMO.OfficeLength = default optional**

**offsetY OfficeIMO.OfficeLength = default optional**

**name string? = null optional**

**altText string? = null optional**

**lockAspectRatio bool = true optional**

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

Returns

`Task<ExcelTemplateImage>`

`public static Task<ExcelTemplateImage> FromUrlAsync(string url, OfficeRemoteImageLoadOptions remoteImageOptions, OfficeLength? width = null, OfficeLength? height = null, OfficeLength offsetX = default, OfficeLength offsetY = default, string? name = null, string? altText = null, bool lockAspectRatio = true, CancellationToken cancellationToken = default)` [#](#member-cdca9ec6853e4a64b6af3e2e)

[ExcelTemplate.cs:140](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L140)

Creates a template image using an explicit remote-network policy.

Parameters

**url string required**

**remoteImageOptions OfficeIMO.Drawing.OfficeRemoteImageLoadOptions required**

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

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

**offsetX OfficeIMO.OfficeLength = default optional**

**offsetY OfficeIMO.OfficeLength = default optional**

**name string? = null optional**

**altText string? = null optional**

**lockAspectRatio bool = true optional**

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

Returns

`Task<ExcelTemplateImage>`

## 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 byte[] Bytes { get; }` [#](#property-bytes)

[ExcelTemplate.cs:81](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L81)

Image bytes when the image is supplied directly.

`public string ContentType { get; }` [#](#property-contenttype)

[ExcelTemplate.cs:84](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L84)

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

`public OfficeLength Width { get; }` [#](#property-width)

[ExcelTemplate.cs:87](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L87)

Image width as a document length.

`public OfficeLength Height { get; }` [#](#property-height)

[ExcelTemplate.cs:90](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L90)

Image height as a document length.

`public OfficeLength OffsetX { get; }` [#](#property-offsetx)

[ExcelTemplate.cs:93](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L93)

Horizontal length offset from the target cell.

`public OfficeLength OffsetY { get; }` [#](#property-offsety)

[ExcelTemplate.cs:96](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L96)

Vertical length offset from the target cell.

`public string? Name { get; }` [#](#property-name)

[ExcelTemplate.cs:99](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L99)

Optional drawing name.

`public string? AltText { get; }` [#](#property-alttext)

[ExcelTemplate.cs:102](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L102)

Optional alternative text description.

`public bool LockAspectRatio { get; }` [#](#property-lockaspectratio)

[ExcelTemplate.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelTemplate.cs#L105)

Whether Excel should keep the picture aspect ratio locked.

<!-- PowerForge markdown artifact sha256:CC584E738E48217DCA408F8E6DDA3B22CC2DD709CE0893F1F56508BC325289A6 -->
