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.

Wed Jul 07, 2021 8:13 am

Hi..
Currently I'm using the spire xls version 11.6.0.5040 and facing a problem when converting an excel file..

Below is the code that I'm using to convert the excel:

Code: Select all
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, res);
         images.Save(pngTarget, ImageFormat.Png);
}


When converting the excel file, the line ToEMFStream hit the error StackOverflowException and immediately break my programme.
Here I attached the sample file for you to test out.
Attachments
Sample excel.zip
(57.24 KiB) Downloaded 412 times

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

Wed Jul 07, 2021 10:41 am

Hello,

Thanks for your inquiry.
I tested your case but did not reproduce your issue. To help us reproduce your issue and solve it, please tell us your project target framework (e.g. .NET Framework 4.5), your region setting (e.g. China, Chinese) and your OS information (e.g. Windows7, 64bit). Thanks in advance for your assistance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Jul 07, 2021 11:06 am

Hi..

My project target framework is .NET Framework 4, region setting is Malaysia, English and OS is Windows10, 64bit..

Thanks..

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

Thu Jul 08, 2021 3:43 am

Hello,

Thanks for providing more information.
I did an initial test in a similar environment, but still did not reproduce your problem. Here I uploaded my test project, please run it directly on your side to see if the issue occurs. Looking forward to your test results.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Jul 08, 2021 4:14 am

Hi..
Thanks for providing a test project.. I have tested and did get the stackoverflow exception..

Here is the test results
https://imgur.com/ALc6kZp

Thanks..

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

Thu Jul 08, 2021 10:48 am

Hello,

Thanks for your feedback.

I tried to run my project on several computers but still didn’t encounter any issue. I suspected this issue may be related to your Visual Studio or your system settings. We recommend that you can try it on another computer or try other versions of Visual studio.

Besides, to help us further analyze, could you provide the detailed stack information of the exception, and tell us which line of code threw the exception?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Jul 08, 2021 12:58 pm

Hi..
I recheck my OS and found out that I'm using windows 10 PRO and not windows 10..not sure if it affects it or not.. meanwhile, I will also try on another PC..

This is the exception screenshot:
https://imgur.com/Cdaw2M9
and it doesn't have much information on the exception..


Thanks..

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

Fri Jul 09, 2021 10:13 am

Hello,

Thanks for your sharing.
I tested you case on windows 10 PRO but still did not reproduce your issue.
I am looking forward to your test results on another PC.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Sat Jul 17, 2021 4:41 am

Hello,

I tested your project in different pc but still get the stackoverflow exception
I have attached oursample project..can u please test on your site too?

thanks

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

Mon Jul 19, 2021 10:15 am

Hello,

Thanks for providing your sample project.
I tested your project and did reproduce your issue. I have logged it in our bug tracking system with the ticket SPIREXLS-3361. If there is any update, we will let you know. Apologize for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Jul 26, 2021 1:55 am

Hi Brian,

Is there any update on this issue?
May I know when is the targeted release date for the hot fix?

Best regards

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

Mon Jul 26, 2021 9:54 am

Hello,

Thanks for your follow up.
After further investigation, we found that your input file contains some multi-level nested formulas. And our Spire.XLS will recalculate the formulas by default during conversion, which will consume more memory. Your issue is also caused by this.
So we recommend that you add the following code to prevent the formula from being recalculated during conversion. At the same time, we will continue to investigate this issue. If there is any progress, we will inform you immediately.
Code: Select all
workbook.ConverterSetting.IsReCalculateOnConvert = false;



Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Jul 27, 2021 9:51 am

Hi Brian,

Thanks for the reply
I will add the code to my project and I look forward to receiving your update on the issue

Best regards

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

Thu Aug 05, 2021 5:18 am

Hi Brian,

Is there any update on this issue?

Best regards

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

Thu Aug 05, 2021 8:20 am

Hello,

Thanks for your follow up.
Due to its complexity and difficulty, our development team is still investigating this issue and working hard to find a solution. Anyway, I have requested our Dev team to share any possible ETA at their earliest time. I will inform you as soon as there is any update.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS