Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Dec 12, 2017 4:04 pm

Hi!
I need to get the image from a specific sheet range (B2:D24, for example)
I have the code:
Code: Select all
Dim ofd As New OpenFileDialog
Dim workbook As New Workbook()
Dim sheet As Worksheet
Dim sImg As String = GetAppPath() & "\imgActual.jpg"
ofd.ShowDialog()
workbook.LoadFromFile(ofd.FileName)
sheet = workbook.Worksheets(0)
sheet.SaveToImage(sImg)
PB.Load(sImg)

But I don't get the image I need.

Is that possible?
Many Thanks!

cescude
 
Posts: 2
Joined: Mon Sep 02, 2013 9:14 am

Wed Dec 13, 2017 2:09 am

Hello,

Thanks for your inquiry.
Our Spire.XLS does support the feature you need. If you were using the free version or old version, we suggest you first upgrade your dlls to the latest hotfix Spire.XLS Pack(Hotfix) Version:7.12.125 and use the "ToImage" method instead.

If you want to save the whole sheet to image, please use:
Code: Select all
Dim image As Image = sheet.ToImage(sheet.FirstRow, sheet.FirstColumn, sheet.LastRow, sheet.LastColumn)
image.Save(sImg )

You could also save a certain range to an image, eg, B2 to D24:
Code: Select all
Dim image As Image = sheet.ToImage(2,2,24,4)
image.Save(sImg )

If the the approaches I suggested do not make sense at your end, please send your sample document to us(support@e-iceblue.com) and then we will look into it.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Dec 14, 2017 8:00 am

Hello cescude,

Greetings from e-iceblue!
Has your issue been resolved? Your feedback will be greatly appreciated.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS