-
Notifications
You must be signed in to change notification settings - Fork 305
Pictures
Mats Alm edited this page Nov 2, 2023
·
18 revisions
EPPlus supports adding pictures/images from a file, a stream or via an image object.
Adding a picture/image to the workbook will work in a very similar way as adding a Shape
//Add an jpg image and apply some effects (EPPlus 6+ interface).
var pic = worksheet.Drawings.AddPicture("Landscape", new FileInfo("c:\\temp\\LandscapeView.jpg"));
pic.SetPosition(2, 0, 1, 0);
pic.Effect.SetPresetShadow(ePresetExcelShadowType.OuterBottomRight);
pic.Effect.OuterShadow.Distance = 10;
pic.Effect.SetPresetSoftEdges(ePresetExcelSoftEdgesType.SoftEdge5Pt);From EPPlus 6, the ExcelImage class replaces all System.Drawing.Common.Image properties (see list above).
| Properties | Description |
|---|---|
| ImageBytes | The image as a byte-array |
| Type | The type of image, for example jpg, gif or svg |
| Bounds | The bounds and resolution of the image |
| Methods | Description |
|---|---|
| SetImage(string) | Sets the image from a file path |
| SetImage(FileInfo) | Sets the image from a FileInfo object |
| SetImage(byte[], ePictureType) | Sets the image from a byte array |
| SetImage(Stream, ePictureType) | Sets the image from a stream |
| SetImage(ExcelImage) | Sets the image from another image object |
| SetImageAsync(string) | Sets the image from a file path |
| SetImageAsync(FileInfo) | Sets the image from a FileInfo object |
| SetImageAsync(Stream, ePictureType) | Sets the image from a stream |
EPPlus Software AB - https://epplussoftware.com
- What is new in EPPlus 5+
- Breaking Changes in EPPlus 5
- Breaking Changes in EPPlus 6
- Breaking Changes in EPPlus 7
- Breaking Changes in EPPlus 8
- Addressing a worksheet
- Dimension/Used range
- Copying ranges/sheets
- Insert/Delete
- Filling ranges
- Sorting ranges
- Taking and skipping columns/rows
- Data validation
- Comments
- Freeze and Split Panes
- Header and Footer
- Hyperlinks
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- The ExcelRange.Text property
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles
-
Formula Calculation
- Security considerations
- Circular references
- Referencing tables in formulas
- Supported Functions
- Dynamic array formulas
- Legacy array formulas
- Lambda functions
- Regression analysis functions
- Custom functions for calculations
- Function prefixes
- Precision as Displayed
- Cancelling a calculation
- Trim reference operator
- Working with filters
- Working with slicers
- Working with External Workbooks