# ExcelImage

Represents a worksheet image anchored in the drawing layer.

Class 

`OfficeIMO.Excel`

**Namespace**

`OfficeIMO.Excel`

**Assembly**

`OfficeIMO.Excel`

**Source revision**

`273d35d5ba8a` with working tree changes

**Source**

[ExcelImage.cs:193](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L193)

**Modifiers**

sealed

Represents a worksheet image anchored in the drawing layer.

## Inheritance

- object
- ExcelImage

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Check accessibility](/docs/before-sharing/accessibility/) Guide
  
  Check Word, Excel and PowerPoint files for missing alt text, table headers, unclear links, low contrast, title and language, and write SARIF for CI.

## Usage

Explore 16 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 16

- Method [ExcelImage.Decorative](/api/excel/officeimo-excel-excelimage/#method-decorative)
- Method [ExcelImage.LockAspectRatio](/api/excel/officeimo-excel-excelimage/#method-lockaspectratio-boolean)
- Method [ExcelImage.MoveTo](/api/excel/officeimo-excel-excelimage/#method-moveto-int32-int32-officeimo-officelength-officeimo-officelength)
- Method [ExcelImage.SetAltText](/api/excel/officeimo-excel-excelimage/#method-setalttext-string-string)
- Method [ExcelImage.SetCropRatio](/api/excel/officeimo-excel-excelimage/#method-setcropratio-double-double-double-double)
- Method [ExcelImage.SetFlip](/api/excel/officeimo-excel-excelimage/#method-setflip-boolean-boolean)
- Method [ExcelImage.SetRotation](/api/excel/officeimo-excel-excelimage/#method-setrotation-double)
- Method [ExcelImage.SetSize](/api/excel/officeimo-excel-excelimage/#method-setsize-officeimo-officelength-officeimo-officelength)
- Method [ExcelImage.SetSizePercent](/api/excel/officeimo-excel-excelimage/#method-setsizepercent-double)
- Method [ExcelImage.SetTwoCellEndingMarker](/api/excel/officeimo-excel-excelimage/#method-settwocellendingmarker-int32-int32-officeimo-officelength-officeimo-officelength)
- Method [ExcelReportBuilder.AddImage](/api/excel/officeimo-excel-excelreportbuilder/#method-addimage-int32-int32-io-stream-officeimo-excel-excelimageoptions)
- Method [ExcelReportBuilder.AddImageAsync](/api/excel/officeimo-excel-excelreportbuilder/#method-addimageasync-int32-int32-string-officeimo-excel-excelimageoptions-threading-cancellationtoken)
- Method [ExcelSheet.AddImage](/api/excel/officeimo-excel-excelsheet/#method-addimage-string-string-officeimo-excel-excelimageoptions)
- Method [ExcelSheet.AddImageAsync](/api/excel/officeimo-excel-excelsheet/#method-addimageasync-int32-int32-io-stream-officeimo-excel-excelimageoptions-threading-cancellationtoken)
- Method [ExcelSheet.GetImage](/api/excel/officeimo-excel-excelsheet/#method-getimage-string)
- Property [ExcelSheet.Images](/api/excel/officeimo-excel-excelsheet/#property-images)

Filter members 

Show inherited

## Methods

`public ExcelImage Decorative()` [#](#method-decorative)

[ExcelImage.cs:346](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L346)

Marks the image as decorative: clears its alt text metadata and sets the Office decorative flag, so Excel and accessibility checkers skip it.

Returns

`ExcelImage`

`public ExcelImage LockAspectRatio(bool locked = true)` [#](#method-lockaspectratio-boolean)

[ExcelImage.cs:359](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L359)

Controls whether Excel should keep the picture aspect ratio locked.

Parameters

**locked bool = true optional**

Returns

`ExcelImage`

`public ExcelImage MoveTo(int row, int column, OfficeLength offsetX = default, OfficeLength offsetY = default)` [#](#method-moveto-int32-int32-officeimo-officelength-officeimo-officelength)

[ExcelImage.cs:520](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L520)

Moves the image to a one-cell anchor position and optionally applies length offsets.

Parameters

**row int required**

1-based target row.

**column int required**

1-based target column.

**offsetX OfficeIMO.OfficeLength = default optional**

Horizontal offset from the cell edge, as a document length.

**offsetY OfficeIMO.OfficeLength = default optional**

Vertical offset from the cell edge, as a document length.

Returns

`ExcelImage`

`public ExcelImage SetAltText(string description, string? title = null)` [#](#method-setalttext-string-string)

[ExcelImage.cs:325](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L325)

Sets image title and description metadata.

Parameters

**description string required**

**title string? = null optional**

Returns

`ExcelImage`

`public ExcelImage SetCropRatio(double left, double top, double right, double bottom)` [#](#method-setcropratio-double-double-double-double)

[ExcelImage.cs:394](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L394)

Sets image crop ratios, where 0 means no crop and 1 means the full source dimension.

Parameters

**left double required**

**top double required**

**right double required**

**bottom double required**

Returns

`ExcelImage`

`public ExcelImage SetFlip(bool horizontal, bool vertical)` [#](#method-setflip-boolean-boolean)

[ExcelImage.cs:430](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L430)

Sets image flip transforms.

Parameters

**horizontal bool required**

**vertical bool required**

Returns

`ExcelImage`

`public ExcelImage SetRotation(double degrees)` [#](#method-setrotation-double)

[ExcelImage.cs:379](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L379)

Sets clockwise image rotation in degrees.

Parameters

**degrees double required**

Clockwise rotation in degrees. Fractional values are supported by DrawingML.

Returns

`ExcelImage`

`public ExcelImage SetSize(OfficeLength width, OfficeLength height)` [#](#method-setsize-officeimo-officelength-officeimo-officelength)

[ExcelImage.cs:442](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L442)

Sets the image size as a document length.

Parameters

**width OfficeIMO.OfficeLength required**

**height OfficeIMO.OfficeLength required**

Returns

`ExcelImage`

`public ExcelImage SetSizePercent(double percent)` [#](#method-setsizepercent-double)

[ExcelImage.cs:501](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L501)

Scales the image from its current size by the specified percentage.

Parameters

**percent double required**

Percentage of the current image size. For example, 20 means 20%.

Returns

`ExcelImage`

`public ExcelImage SetTwoCellEndingMarker(int toRow, int toColumn, OfficeLength toOffsetX = default, OfficeLength toOffsetY = default)` [#](#method-settwocellendingmarker-int32-int32-officeimo-officelength-officeimo-officelength)

[ExcelImage.cs:217](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L217)

Sets the ending marker for a two-cell anchored image using 1-based worksheet marker coordinates.

Parameters

**toRow int required**

1-based ending row marker.

**toColumn int required**

1-based ending column marker.

**toOffsetX OfficeIMO.OfficeLength = default optional**

Horizontal offset from the ending marker column.

**toOffsetY OfficeIMO.OfficeLength = default optional**

Vertical offset from the ending marker row.

Returns

`ExcelImage`

`public byte[] ToBytes()` [#](#method-tobytes)

[ExcelImage.cs:299](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L299)

Returns a copy of the image bytes from the worksheet drawing relationship. An SVG picture returns its SVG.

Returns

`byte[]`

`public bool TryGetAbsoluteAnchorBounds(out OfficeLength x, out OfficeLength y, out OfficeLength width, out OfficeLength height)` [#](#method-trygetabsoluteanchorbounds-officeimo-officelength-officeimo-officelength-officeimo-officelength-officeimo-officelength)

[ExcelImage.cs:193](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L193)

Tries to read the image bounds when it is positioned by an absolute worksheet drawing anchor.

Parameters

**x OfficeIMO.OfficeLength required**

**y OfficeIMO.OfficeLength required**

**width OfficeIMO.OfficeLength required**

**height OfficeIMO.OfficeLength required**

Returns

`bool`

## 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 string Name { get; set; }` [#](#property-name)

[ExcelImage.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L39)

Gets or sets the image drawing name.

`public string Title { get; set; }` [#](#property-title)

[ExcelImage.cs:53](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L53)

Gets or sets the image title metadata.

`public int? TransparencyPercent { get; set; }` [#](#property-transparencypercent)

[ExcelImage.cs:69](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L69)

Gets or sets DrawingML picture transparency from 0 through 100 percent. Null removes the explicit alpha transform.

`public string Description { get; set; }` [#](#property-description)

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

Gets or sets the image alternative text description.

`public bool IsAspectRatioLocked { get; }` [#](#property-isaspectratiolocked)

[ExcelImage.cs:116](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L116)

Gets whether Excel should keep the picture aspect ratio locked.

`public int RowIndex { get; }` [#](#property-rowindex)

[ExcelImage.cs:121](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L121)

Gets the 1-based row index where the image is anchored, when available.

`public int ColumnIndex { get; }` [#](#property-columnindex)

[ExcelImage.cs:126](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L126)

Gets the 1-based column index where the image is anchored, when available.

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

[ExcelImage.cs:131](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L131)

Gets the image width as a document length from the drawing extent.

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

[ExcelImage.cs:136](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L136)

Gets the image height as a document length from the drawing extent.

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

[ExcelImage.cs:141](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L141)

Gets the image horizontal offset from the anchor cell origin as a document length.

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

[ExcelImage.cs:146](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L146)

Gets the image vertical offset from the anchor cell origin as a document length.

`public bool HasTwoCellAnchor { get; }` [#](#property-hastwocellanchor)

[ExcelImage.cs:151](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L151)

Gets whether the image is positioned with a two-cell drawing anchor.

`public bool HasAbsoluteAnchor { get; }` [#](#property-hasabsoluteanchor)

[ExcelImage.cs:156](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L156)

Gets whether the image is positioned with an absolute drawing anchor.

`public int? ToRowIndex { get; }` [#](#property-torowindex)

[ExcelImage.cs:172](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L172)

Gets the 1-based ending row index for two-cell anchored images, when available.

`public int? ToColumnIndex { get; }` [#](#property-tocolumnindex)

[ExcelImage.cs:177](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L177)

Gets the 1-based ending column index for two-cell anchored images, when available.

`public OfficeLength ToOffsetX { get; }` [#](#property-tooffsetx)

[ExcelImage.cs:182](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L182)

Gets the horizontal offset from the two-cell ending marker column as a document length.

`public OfficeLength ToOffsetY { get; }` [#](#property-tooffsety)

[ExcelImage.cs:187](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L187)

Gets the vertical offset from the two-cell ending marker row as a document length.

`public double CropLeftRatio { get; }` [#](#property-cropleftratio)

[ExcelImage.cs:245](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L245)

Gets the left crop ratio authored on the image, where 0 means no crop and 1 means the full width.

`public double CropTopRatio { get; }` [#](#property-croptopratio)

[ExcelImage.cs:250](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L250)

Gets the top crop ratio authored on the image, where 0 means no crop and 1 means the full height.

`public double CropRightRatio { get; }` [#](#property-croprightratio)

[ExcelImage.cs:255](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L255)

Gets the right crop ratio authored on the image, where 0 means no crop and 1 means the full width.

`public double CropBottomRatio { get; }` [#](#property-cropbottomratio)

[ExcelImage.cs:260](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L260)

Gets the bottom crop ratio authored on the image, where 0 means no crop and 1 means the full height.

`public double RotationDegrees { get; set; }` [#](#property-rotationdegrees)

[ExcelImage.cs:266](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L266)

Gets or sets clockwise image rotation in degrees.

`public bool FlipHorizontal { get; }` [#](#property-fliphorizontal)

[ExcelImage.cs:273](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L273)

Gets whether the image has an authored horizontal flip transform.

`public bool FlipVertical { get; }` [#](#property-flipvertical)

[ExcelImage.cs:278](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L278)

Gets whether the image has an authored vertical flip transform.

`public int DrawingOrder { get; }` [#](#property-drawingorder)

[ExcelImage.cs:283](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L283)

Gets this image anchor's zero-based order in the worksheet drawing layer.

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

[ExcelImage.cs:290](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L290)

Gets the image content type, such as image/png or image/jpeg. An SVG picture reports its SVG, not the PNG fallback.

`public bool IsDecorative { get; }` [#](#property-isdecorative)

[ExcelImage.cs:339](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.cs#L339)

Gets whether the image is marked decorative, so screen readers and accessibility checks skip it.

`public Uri? HyperlinkUri { get; set; }` [#](#property-hyperlinkuri)

[ExcelImage.Hyperlinks.cs:17](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelImage.Hyperlinks.cs#L17)

Gets or sets the picture's external hyperlink target. Null removes the click link. Targets are stored in the workbook and are never opened by OfficeIMO.

<!-- PowerForge markdown artifact sha256:58652BED7521AD6AB1D5FBF986D744A03F62DD721E0DCF22D02DA7E1EEDDA55E -->
