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 Mar 16, 2021 4:46 am

Hi..Currently I'm using this method https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Conversion/Convert-Excel-Sheet-to-a-High-Resolution-Image-in-C-VB.NET.html to convert the excel to high resolution image.

My excel file got 3 sheets. When I convert all(3 sheets) at the same time, the second sheet's content is always unclear(low resolution). But when I only convert the second sheet, the content is very clear to see. Is this a bug or the way I'm doing it is wrong?

below is my code and step to reproduce the issue:

1. convert all sheet to image: fromPage = 0, untilPage=2
2. convert specific page: fromPage=1,untilPage=1

Code: Select all
for (int i = fromPage; i < workbook.Worksheets.Count && i <= untilPage; i++)
{
   Worksheet sheet = workbook.Worksheets[i];

   if (!sheet.IsEmpty)
   {
      var target = path + Path.DirectorySeparatorChar + "Sheet_" + sheet.Name + "_Page_" + i.ToString();
      var pngTarget = Path.ChangeExtension(target, "png");
         
      using (MemoryStream ms = new MemoryStream())
      {

         sheet.ToEMFStream(ms, sheet.FirstRow, sheet.FirstColumn, sheet.LastRow, sheet.LastColumn);
         Image image = Image.FromStream(ms);
         Bitmap images = ResetResolutionExcel(image as Metafile, 300);
         images.Save(pngTarget, ImageFormat.Png);
      }
      
   }
}


Here I also attached the sample file for testing
Attachments
Sample.zip
(52.7 KiB) Downloaded 133 times

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Tue Mar 16, 2021 7:27 am

Hello,

Thanks for your inquiry.
I did an initial test with the latest Spire.XLS v:11.3.4 and did observe the behavior you mentioned. I have posted it to our Dev team with the ticket SPIREXLS-3159 for further investigation. If there is any update, we will let you know. Sorry for the inconvenience caused.

Sincerely
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Tue Apr 06, 2021 10:12 am

Hello,

Hope you are doing well.
Glad to inform you that we just released Spire.XLS Pack(Hotfix) Version:11.4.0 which fixes your issue. Welcome to download it from the following links.
Our website: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget: https://www.nuget.org/packages/Spire.Xls/11.4.0

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Thu Apr 08, 2021 7:12 am

Hello,

Greetings from E-iceblue.
Does the hotfix solve the issue ? Could you please give us some feedback at your convenience?
Last edited by Andy.Zhou on Fri Apr 23, 2021 8:51 am, edited 1 time in total.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Apr 23, 2021 5:18 am

Hi..
The issue solved with the hot fix version..
Thanks..

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Fri Apr 23, 2021 6:04 am

xiao0207 wrote:Hi..
The issue solved with the hot fix version..
Thanks..


Hello,

Glad to hear that the issue has been solved.
If you encounter any issues related to our product in the future, just feel free to contact us.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.XLS