Class ExcelImage
Represents an image
Inheritance
Inherited Members
Namespace: OfficeOpenXml.Drawing
Assembly: EPPlus.dll
Syntax
public class ExcelImage
Constructors
ExcelImage()
Creates an ExcelImage to be used as template for adding images.
Declaration
public ExcelImage()
ExcelImage(Byte[], ePictureType)
Creates an ExcelImage to be used as template for adding images.
Declaration
public ExcelImage(byte[] imageBytes, ePictureType pictureType)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageBytes | The image as a byte array |
OfficeOpenXml.Drawing.ePictureType | pictureType | The type of image loaded in the stream |
ExcelImage(FileInfo)
Creates an ExcelImage to be used as template for adding images.
Declaration
public ExcelImage(FileInfo imageFile)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | imageFile | A FileInfo referencing the image file to load |
ExcelImage(Stream, ePictureType)
Creates an ExcelImage to be used as template for adding images.
Declaration
public ExcelImage(Stream imageStream, ePictureType pictureType)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | imageStream | The stream containing the image |
OfficeOpenXml.Drawing.ePictureType | pictureType | The type of image loaded in the stream |
ExcelImage(String)
Creates an ExcelImage to be used as template for adding images.
Declaration
public ExcelImage(string imagePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | imagePath | A path to the image file to load |
Properties
Bounds
The image bounds and resolution
Declaration
public ExcelImageInfo Bounds { get; }
Property Value
Type | Description |
---|---|
ExcelImageInfo |
HasImage
If this object contains an image.
Declaration
public bool HasImage { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ImageBytes
The image as a byte array.
Declaration
public byte[] ImageBytes { get; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Type
The type of image.
Declaration
public ePictureType? Type { get; }
Property Value
Type | Description |
---|---|
System.Nullable<OfficeOpenXml.Drawing.ePictureType> |
Methods
SetImage(ExcelImage)
Sets a new image.
Declaration
public ExcelImage SetImage(ExcelImage image)
Parameters
Type | Name | Description |
---|---|---|
ExcelImage | image | The image object to use. |
Returns
Type | Description |
---|---|
ExcelImage |
See Also
SetImage(Byte[], ePictureType)
Sets a new image.
Declaration
public ExcelImage SetImage(byte[] imageBytes, ePictureType pictureType)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageBytes | The image as a byte array. |
OfficeOpenXml.Drawing.ePictureType | pictureType | The type of image. |
Returns
Type | Description |
---|---|
ExcelImage |
SetImage(FileInfo)
Sets a new image.
Declaration
public void SetImage(FileInfo imageFile)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | imageFile | The image file. |
SetImage(Stream, ePictureType)
Sets a new image.
Declaration
public ExcelImage SetImage(Stream imageStream, ePictureType pictureType)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | imageStream | The stream containing the image. |
OfficeOpenXml.Drawing.ePictureType | pictureType | The type of image. |
Returns
Type | Description |
---|---|
ExcelImage |
SetImage(String)
Sets a new image.
Declaration
public void SetImage(string imagePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | imagePath | The path to the image file. |
SetImageAsync(FileInfo)
Sets a new image.
Declaration
public async Task<ExcelImage> SetImageAsync(FileInfo imageFile)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | imageFile | The image file. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ExcelImage> |
SetImageAsync(Stream, ePictureType)
Sets a new image.
Declaration
public async Task<ExcelImage> SetImageAsync(Stream imageStream, ePictureType pictureType)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | imageStream | The stream containing the image. |
OfficeOpenXml.Drawing.ePictureType | pictureType | The type of image. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ExcelImage> |
SetImageAsync(String)
Sets a new image.
Declaration
public async Task<ExcelImage> SetImageAsync(string imagePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | imagePath | The path to the image file. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ExcelImage> |