Free Support Forum - aspose.com

Unusual problem with recalculation

I’m having a problem with some formula not being recalculated depending on how Excel is launched.


Using the following code:

Workbook wb = new Workbook(“Book1.xlsx”);

Double d = 0;

for (Int32 i = 0; i < 10; i++)
wb.Worksheets[“Sheet1”].Cells[i, 0].PutValue(d += 0.5);

wb.CalculateFormula();

wb.Save(“Book1-Out.xlsx”);

ProcessStartInfo startInfo = new ProcessStartInfo(@“C:\Program Files\Microsoft Office\Office14\Excel.exe”);
startInfo.Arguments = “Book1-Out.xlsx”;
startInfo.UseShellExecute = true;

Process p = new Process();
p.StartInfo = startInfo;
p.Start();

The code opens the attached Book1.xlsx, changes some values, recalculates, saves and then opens the file in Excel. When opened the contents of column C in Sheet1 and column A in Sheet2 show ‘#VALUE!’.

If I resave the file using Excel the resaved copy will not recalculate on open/close and will only show correct values if I do a full recalculate using ctrl-alt-f9.

If however I change my program to remove the code that starts Excel leaving this:

Workbook wb = new Workbook(“Book1.xlsx”);

Double d = 0;

for (Int32 i = 0; i < 10; i++)
wb.Worksheets[“Sheet1”].Cells[i, 0].PutValue(d += 0.5);

wb.CalculateFormula();

wb.Save(“Book1-Out.xlsx”);

I can execute the application, then open Book1-Out.xlsx using Windows Explorer. In this case the file opens in Excel and recalculates properly.

Any idea why the sheet does not recalculate when executed from my C# application? This issue is occurring with Aspose.Cells v6.0.0.0.

Thanks

Hi Jeff,


I am afraid, I was unable to replicate your said issue with Visual Studio 2010 Framework 4.0 application and MS Excel 2010 64bit version. I executed the same source code provided in your post and it works fine for me [After saving the Workbook to disk, Excel opens the file with all formulae calculated fine]. I have attached snapshot of my output and the version of MS Excel for your reference.

Can you please share your Excel version with us?

Thanks for the reply.


I am using Excel 2010 64 bit on Windows 7.

I have attached the raw output from my application (Book1-Out.xlsx), and a version I have saved using Save As in Excel (Book1-Out-SaveAs.xlsx).

The problem does not occur for me using Aspose.Cells v5.3.3.0, but does using v5.3.3.3 and v6.0.0.0. The problem only occurs when launching Excel from my application, not when I open the xlsx file via Windows Explorer.

Thanks

Hi,


Thank you for your sample files.
But I am sorry, I am still unable to replicate your said issue. I am using MS Excel 2010 64bit on Windows 7 platform. My test console application uses Framework 4.0.

Can you help us by providing a simple console application that can reproduce this problem? Also test your application with Aspose.Cells for .NET v6.0.0.1

As you have mentioned that the same code was working fine with v5.3.3.0 and it is not working with v6.0. That seems to be a problem in later version. But I am afraid, right now I do not have any material/evidence to log it in our Bug Tracking System as an Issue.

Regards,

I have tested my application with v6.0.0.1 and still have the same problem.


I’ve attached the sample application I am using for testing and have included a screenshot of what I see in Excel when opening with the console application and with windows explorer.

Thanks

Hi,


Thanks for providing your sample application.
We are able to reproduce your said issue by generating a PDF file and then open the same PDF in Acrobat Reader using the below source code.
We have communicated this issue to our development team as well. The work on this issue is under progress and hopefully we will sort this out. Soon we will also provide the Ticket ID for your reference.

C# Code

Workbook wb = new Workbook(“C:\temp\book-11.xlsx”);


Double d = 0;


for (Int32 i = 0; i < 10; i++)

wb.Worksheets[“Sheet1”].Cells[i, 0].PutValue(d += 0.5);


wb.CalculateFormula();


wb.Save(“c:\temp\Book1-Out.pdf”,SaveFormat.Pdf);


ProcessStartInfo startInfo = new ProcessStartInfo(@“C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe”);

startInfo.Arguments = “c:\temp\Book1-Out.pdf”;

startInfo.UseShellExecute = true;


Process p = new Process();

p.StartInfo = startInfo;

p.Start();



Hi Jeff,


The Ticket ID for your logged issue is CELLSNET-28626.

Hi Jeff,


We have fixed your mentioned issue in our latest fix version of Aspose.Cells for .NET v 6.0.0.2 [attached]. Please test your scenario with this latest assembly and let us know of your feedback.
Thank you

The issues you have found earlier (filed as 28626) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.