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.

Fri Feb 19, 2021 8:28 am

Dear SupportTeam,

we are recently upgraded Spire.xls from 7.12 to 11.2.3.0 and processing a excel template which has lot of formulas in it. After upgrading the spire excel, we are receiving the following error in workbook.CalculateAllValue()

Code: Select all
2021-02-19 13:20:25.7987|ERROR|Swepco.Home|Object reference not set to an instance of an object.
2021-02-19 13:20:25.9060|ERROR|Swepco.Home|   at spr?.?(Boolean A_0, spr? A_1)
   at spr?.?()
   at Swepco.Home.downProposal_Click(Object sender, EventArgs e) in D:\Projects\SWEPCO\Source\Swepco\Swepco\Home.aspx.cs:line 99


sample code below

Code: Select all
                   Workbook workbook = new Workbook();
                    workbook.LoadFromFile(@Standardpath);
                   
                   
                    MemoryStream ms = new MemoryStream();
                    try
                    {
                        workbook.CalculateAllValue(); //error here
                    }catch(Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                    }
                   
                    workbook.SaveToStream(ms);
                    byte[] bytesInStream = ms.ToArray();
                    ms.Close();


Also attached the sample excel which has all the formulas but failed to "CalculateAllValue()"


Please advise..

Thanks in advance
Eswaran
Attachments
Sample.zip
Excel Template
(332.71 KiB) Downloaded 123 times

raavaneswaran
 
Posts: 3
Joined: Fri Feb 19, 2021 8:01 am

Fri Feb 19, 2021 9:55 am

Hello Eswaran,

Thanks for your inquiry.
I tested your scenario with Spire.XLS v11.2.3, but did not encounter any issue. To help us further investigate, please provide your OS information (e.g. Win7 64bit) and your region setting (e.g. China, Chinese). Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

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

Fri Feb 19, 2021 11:52 am

Hi Brian,


OS information : Win10 Pro - 64 bit
Region: United Kingdom


Thanks
Eswaran

raavaneswaran
 
Posts: 3
Joined: Fri Feb 19, 2021 8:01 am

Fri Feb 19, 2021 1:30 pm

Hi Brian,

I have workaround for this.

Code: Select all
Step1: LoadFromFile(Location_A)
Step2: process and update the file (without CalculateAllValue)
Step3: SaveToFile(Location_B)
Step4: LoadFromFile(Location_B)
Step5: Apply CalculateAllValue()
Step6: SaveToStream


The above workaround solved my problem.

Thanks
Eswaran

raavaneswaran
 
Posts: 3
Joined: Fri Feb 19, 2021 8:01 am

Sat Feb 20, 2021 7:51 am

Hello Eswaran,

Glad to hear that you found the workaround!

However, even if I tested the following code under the similar environment as yours, I still did not reproduce your issue.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("Sample.xlsx");
            workbook.CalculateAllValue(); //I did not get any error
            workbook.SaveToFile("result.xlsx");


Here I attached my executable application, please directly run the xls.exe on your system and check the result. Looking forward to your testing feedback.
Executable application: https://www.e-iceblue.com/downloads/demo/24459Demo.zip

Sincerely,
Brian
E-iceblue support team
User avatar

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

Tue Mar 02, 2021 8:16 am

Hello,

How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

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

Return to Spire.XLS