The sample demonstrates how to read images from spreadsheet.
private void btnRun_Click(object sender, System.EventArgs e) { Workbook workbook = new Workbook(); workbook.LoadFromFile(@"..\..\..\..\..\..\Data\ImageSample.xls"); Worksheet sheet = workbook.Worksheets[0]; ExcelPicture pic = sheet.Pictures[0]; using( 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; frm1.Controls.Add(pic1); frm1.ShowDialog(); } } private void ExcelDocViewer( string fileName ) { try { System.Diagnostics.Process.Start(fileName); } catch{} }
Private Sub btnRun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRun.Click Dim workbook As Workbook = New Workbook() workbook.LoadFromFile("..\..\..\..\..\..\Data\ImageSample.xls") Dim sheet As Worksheet = workbook.Worksheets(0) Dim pic As ExcelPicture = sheet.Pictures(0) Dim frm1 As Form = New Form() Try Dim pic1 As PictureBox = New PictureBox() pic1.Image = pic.Picture frm1.Width = pic.Picture.Width frm1.Height = pic.Picture.Height frm1.StartPosition = FormStartPosition.CenterParent pic1.Dock = DockStyle.Fill frm1.Controls.Add(pic1) frm1.ShowDialog() Finally CType(frm1, IDisposable).Dispose() End Try End Sub Private Sub ExcelDocViewer(ByVal fileName As String) Try System.Diagnostics.Process.Start(fileName) Catch End Try End Sub