Use C# to read images from spreadsheet - TechRepublic
General discussion
December 22, 2010 at 12:12 AM
stephen9530

Use C# to read images from spreadsheet

by stephen9530 . Updated 15 years, 6 months ago

c# source:

01 private void btnRun_Click(object sender, System.EventArgs e)
02 {
03 Workbook workbook = new Workbook();
04 workbook.LoadFromFile(@”..\..\..\..\..\..\Data\ImageSample.xls”);
05 Worksheet sheet = workbook.Worksheets[0];
06
07 ExcelPicture pic = sheet.Pictures[0];
08
09 using( Form frm1 = new Form())
10 {
11 PictureBox pic1 = new PictureBox();
12 pic1.Image = pic.Picture;
13 frm1.Width = pic.Picture.Width;
14 frm1.Height = pic.Picture.Height;
15 frm1.StartPosition = FormStartPosition.CenterParent;
16 pic1.Dock = DockStyle.Fill;
17 frm1.Controls.Add(pic1);
18 frm1.ShowDialog();
19 }
20 }
21
22 private void ExcelDocViewer( string fileName )
23 {
24 try
25 {
26 System.Diagnostics.Process.Start(fileName);
27 }
28 catch{}
29 }

codes from e-iceblue
http://www.e-iceblue.com/Knowledgebase/Spire.XLS/Demos/Images.html

This discussion is locked

All Comments