VIDEOS

How to Add, Extract, and Remove Images from Worksheets

Regan Pun
Regan Pun
March 31, 2024
Share:


In this tutorial, we delve into the process of handling images within Excel spreadsheets using the IronXL library in C#. The session begins with the installation of the IronXL library via the NuGet package manager. First, we import the necessary namespaces for drawing and IronXL functionalities. A new Excel workbook is created, and its default worksheet is selected. The 'insert image' method is employed, which requires the image file path and its dimensions, defined by the top left and bottom right corners of the spreadsheet. We then retrieve a list of images in the worksheet using the 'images' property, looping through each image to convert it into a bitmap object for saving. Additionally, the tutorial demonstrates how to remove images using the 'remove image' method by specifying the image ID. Finally, all changes are saved into a new Excel file, named 'insert images.xlsx'. Upon running the project, the Excel file successfully displays the added images, appropriately sized and positioned. The tutorial concludes with a brief on checking the extracted photos saved as individual PNG files with unique IDs. Viewers are encouraged to engage with the content by liking, subscribing, and trying out the software through a trial subscription.

Get stated with IronXL now.
green arrow pointer

Regan Pun
Software Engineer
Regan graduated from the University of Reading, with a BA in Electronic Engineering. Before joining Iron Software, his previous job roles had him laser-focused on single tasks; and what he most enjoys at Iron Software is the spectrum of work he gets to undertake, whether it’s adding value to sales, technical support, product development or marketing. He enjoys understanding the way developers are using the Iron Software library, and using that knowledge to continually improve documentation and develop the products.
< PREVIOUS
How to Add Freeze Panes to Spreadsheets in Excel
NEXT >
C# Excel Tutorial: Learn to use IronXL Library (No Interop)