In the last post, I show the method to write image in an Excel file. But, if I want to read image from one Excel file in a form via Spire.XLS, how should I do?
Firstly, we need to create a project as usual. I name it ReadImage.
Secondly, add references: Spire.XLS, System.Drawing, System.Windows.Forms (we need to show image in one form).
In this example, the image I will read is from another Excel file which I have in my computer, not the file I generate last time.
Then, use the following code.
static void Main(string args)
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets;
ExcelPicture pic = sheet.Pictures;
Form frm1 = new Form();
PictureBox pic1 = new PictureBox();
pic1.Image = pic.Picture;
frm1.Width = pic.Picture.Width;
frm1.Height = pic.Picture.Height;
frm1.StartPosition = FormStartPosition.CenterParent;
pic1.Dock = DockStyle.Fill;
After running, we can get the result as following: