ExcelPicture Class |
Namespace: GemBox.Spreadsheet
The ExcelPicture type exposes the following members.
Name | Description | |
---|---|---|
![]() | HasHyperlink | Obsolete.
Gets a value indicating whether this drawing (picture, chart, etc.) has hyperlink.
(Inherited from ExcelDrawing.) |
![]() | Hyperlink |
Gets or sets the hyperlink on this drawing (picture, chart, etc.).
(Inherited from ExcelDrawing.) |
![]() | Metadata |
Gets the metadata (non-visual properties) of this ExcelDrawing instance.
(Inherited from ExcelDrawing.) |
![]() | PictureFormat |
Gets the picture format.
|
![]() | PictureStream |
Gets the picture stream.
|
![]() | Position |
Gets the position of this drawing (picture, chart, etc.) in the worksheet.
(Inherited from ExcelDrawing.) |
![]() | Worksheet |
Gets the parent worksheet.
(Inherited from ExcelDrawing.) |
Name | Description | |
---|---|---|
![]() | Delete |
Removes this ExcelPicture instance from the worksheet.
|
![]() | Format |
Formats this drawing (picture, chart, etc.) to its default size so it can be exported to PDF, XPS, image or be printed.
(Inherited from ExcelDrawing.) |
![]() | Format(Double, Double, LengthUnit) |
Formats this drawing (picture, chart, etc.) to specified size so it can be exported to PDF, XPS, image or be printed.
(Inherited from ExcelDrawing.) |
![]() | ToImage |
Converts this ExcelPicture instance to a new Image instance.
|
![]() | ToString |
Returns a String that represents this ExcelPicture instance.
(Overrides ObjectToString.) |
Following code demonstrates how to use images:
sheet.Pictures.Add("Image.bmp", 10, 50, 100, 100, LengthUnit.Pixel); sheet.Pictures.Add("Image.bmp", 10, 50, 100, 100, LengthUnit.Pixel).Position.Mode = PositioningMode.Move; sheet.Pictures.Add("Image.bmp", "A2").Position.Mode = PositioningMode.MoveAndSize; sheet.Pictures.Add("Image.bmp", new AnchorCell(sheet.Columns[0], sheet.Rows[1], 10, 10, LengthUnit.Pixel), new AnchorCell(sheet.Columns[3], sheet.Rows[3], false)); // NOTE: pictureStream must not be disposed while it is still used by ExcelFile or exception will be thrown. var pictureStream = new MemoryStream(File.ReadAllBytes("Image.bmp")); // Picture format needs to be specified when adding from stream. sheet.Pictures.Add(pictureStream, ExcelPictureFormat.Bmp, new AnchorCell(sheet.Columns[0], sheet.Rows[1], 10, 10, LengthUnit.Pixel), new AnchorCell(sheet.Columns[3], sheet.Rows[3], false));