ExcelImage
OfficeIMO.Excel
Represents a worksheet image anchored in the drawing layer.
Inheritance
- object
- ExcelImage
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
- Method ExcelImage.LockAspectRatio
- Method ExcelImage.MoveTo
- Method ExcelImage.SetAltText
- Method ExcelImage.SetCropRatio
- Method ExcelImage.SetFlip
- Method ExcelImage.SetRotation
- Method ExcelImage.SetSize
- Method ExcelImage.SetSizePercent
- Method ExcelImage.SetTwoCellEndingMarker
- Method ExcelReportBuilder.AddImage
- Method ExcelReportBuilder.AddImageAsync
- Method ExcelSheet.AddImage
- Method ExcelSheet.AddImageAsync
- Method ExcelSheet.GetImage
- Property ExcelSheet.Images
Methods
public ExcelImage Decorative() #Marks the image as decorative: clears its alt text metadata and sets the Office decorative flag, so Excel and accessibility checkers skip it.
Returns
ExcelImagepublic ExcelImage LockAspectRatio(bool locked = true) #Controls whether Excel should keep the picture aspect ratio locked.
Parameters
- locked bool = true
Returns
ExcelImagepublic ExcelImage MoveTo(int row, int column, OfficeLength offsetX = default, OfficeLength offsetY = default) #Moves the image to a one-cell anchor position and optionally applies length offsets.
Parameters
- row int
- 1-based target row.
- column int
- 1-based target column.
- offsetX OfficeIMO.OfficeLength = default
- Horizontal offset from the cell edge, as a document length.
- offsetY OfficeIMO.OfficeLength = default
- Vertical offset from the cell edge, as a document length.
Returns
ExcelImagepublic ExcelImage SetAltText(string description, string? title = null) #Sets image title and description metadata.
Parameters
- description string
- title string? = null
Returns
ExcelImagepublic ExcelImage SetCropRatio(double left, double top, double right, double bottom) #Sets image crop ratios, where 0 means no crop and 1 means the full source dimension.
Parameters
- left double
- top double
- right double
- bottom double
Returns
ExcelImagepublic ExcelImage SetFlip(bool horizontal, bool vertical) #Sets image flip transforms.
Parameters
- horizontal bool
- vertical bool
Returns
ExcelImagepublic ExcelImage SetRotation(double degrees) #Sets clockwise image rotation in degrees.
Parameters
- degrees double
- Clockwise rotation in degrees. Fractional values are supported by DrawingML.
Returns
ExcelImagepublic ExcelImage SetSize(OfficeLength width, OfficeLength height) #Sets the image size as a document length.
Parameters
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
Returns
ExcelImagepublic ExcelImage SetSizePercent(double percent) #Scales the image from its current size by the specified percentage.
Parameters
- percent double
- Percentage of the current image size. For example, 20 means 20%.
Returns
ExcelImagepublic ExcelImage SetTwoCellEndingMarker(int toRow, int toColumn, OfficeLength toOffsetX = default, OfficeLength toOffsetY = default) #Sets the ending marker for a two-cell anchored image using 1-based worksheet marker coordinates.
Parameters
- toRow int
- 1-based ending row marker.
- toColumn int
- 1-based ending column marker.
- toOffsetX OfficeIMO.OfficeLength = default
- Horizontal offset from the ending marker column.
- toOffsetY OfficeIMO.OfficeLength = default
- Vertical offset from the ending marker row.
Returns
ExcelImagepublic byte[] ToBytes() #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) #Tries to read the image bounds when it is positioned by an absolute worksheet drawing anchor.
Parameters
- x OfficeIMO.OfficeLength
- y OfficeIMO.OfficeLength
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
Returns
boolInherited Methods
Properties
public int? TransparencyPercent { get; set; } #Gets or sets DrawingML picture transparency from 0 through 100 percent. Null removes the explicit alpha transform.
public string Description { get; set; } #Gets or sets the image alternative text description.
public bool IsAspectRatioLocked { get; } #Gets whether Excel should keep the picture aspect ratio locked.
public int RowIndex { get; } #Gets the 1-based row index where the image is anchored, when available.
public int ColumnIndex { get; } #Gets the 1-based column index where the image is anchored, when available.
public OfficeLength Width { get; } #Gets the image width as a document length from the drawing extent.
public OfficeLength Height { get; } #Gets the image height as a document length from the drawing extent.
public OfficeLength OffsetX { get; } #Gets the image horizontal offset from the anchor cell origin as a document length.
public OfficeLength OffsetY { get; } #Gets the image vertical offset from the anchor cell origin as a document length.
public bool HasTwoCellAnchor { get; } #Gets whether the image is positioned with a two-cell drawing anchor.
public bool HasAbsoluteAnchor { get; } #Gets whether the image is positioned with an absolute drawing anchor.
public int? ToRowIndex { get; } #Gets the 1-based ending row index for two-cell anchored images, when available.
public int? ToColumnIndex { get; } #Gets the 1-based ending column index for two-cell anchored images, when available.
public OfficeLength ToOffsetX { get; } #Gets the horizontal offset from the two-cell ending marker column as a document length.
public OfficeLength ToOffsetY { get; } #Gets the vertical offset from the two-cell ending marker row as a document length.
public double CropLeftRatio { get; } #Gets the left crop ratio authored on the image, where 0 means no crop and 1 means the full width.
public double CropTopRatio { get; } #Gets the top crop ratio authored on the image, where 0 means no crop and 1 means the full height.
public double CropRightRatio { get; } #Gets the right crop ratio authored on the image, where 0 means no crop and 1 means the full width.
public double CropBottomRatio { get; } #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; } #Gets or sets clockwise image rotation in degrees.
public bool FlipHorizontal { get; } #Gets whether the image has an authored horizontal flip transform.
public bool FlipVertical { get; } #Gets whether the image has an authored vertical flip transform.
public int DrawingOrder { get; } #Gets this image anchor's zero-based order in the worksheet drawing layer.
public string ContentType { get; } #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; } #Gets whether the image is marked decorative, so screen readers and accessibility checks skip it.
public Uri? HyperlinkUri { get; set; } #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.