Free Support Forum - aspose.com

Get different formula results from GridDesktop and Aspose.Cells

Hi Team,


Here is the usage scenario I use Aspose.Cells.GridDesktop.GridDesktop control and Aspose.Cells.Workbook class in my project.

1. Create a GridDesktop control for user to input the data.
2. Save the data as Stream using GridDesktop.ExportExcelFile() method.
3. Create a Workbook instance by the saved Stream to read to data.

But I met a problem to get the correct value from Workbook instance.

For example, input number “1” in cell A1, then input a formula “=IF(A1=1,10,0)” in cell A2, input a formula “=IF(A1=“1”,10,0)” in cell A3.
In the GridDesktop control, I get the some result “10” from cell A2 and A3.
But when I try to get the data from Workbook instance, I get the different results “10” from A2 and “0” from A3.

Here are the example codes:

gridDesktop.Worksheets[0].Cells[0,0].Value = 1;
gridDesktop.Worksheets[0].Cells[0,1].Value = “=IF(A1=1,10,0)”;
gridDesktop.Worksheets[0].Cells[0,2].Value = “=IF(A1=“1”,10,0)”;
gridDesktop.RunAllFormulas();

Console.WriteLine("A2 Cell Value: " + gridDesktop.Worksheets[0].Cells[0,1].Value);
Console.WriteLine("A3 Cell Value: " + gridDesktop.Worksheets[0].Cells[0,2].Value);

MemoryStream ms = new MemoryStream();
gridDesktop.ExportExcelFile(ms);
Workbook wb = new Workbook(ms);
wb.CalculateFormula();

Console.WriteLine("A2 Cell Value: " + wb.Worksheets[0].Cells[0,1].DoubleValue);
Console.WriteLine("A3 Cell Value: " + wb.Worksheets[0].Cells[0,2].DoubleValue);


Is there any solution to help me to get the same result from Workbook instance as GridDesktop control?

Thanks.

Hi,


Thanks for sharing the sample code.

Well, Aspose.Cells works the same way as MS Excel does. I have evaluated your case and also tested your sample code. For confirmation you may try to simulate the scenario in MS Excel and when you insert formula “=IF(A1=“1”,10,0)” into A3 cell, MS Excel also gives you “0” as I tested it. So, this is not an issue with Aspose.Cells component.

Thank you.

Hi,


Thanks for the response.

I know the Aspose.Cells works the same way as MS Excel. But the problem it is the Aspose.Cells.GridDesktop.GridDesktop control do not work as MS Excel. I just want to know is there any solution to ensure getting the same result from Aspose.Cells and GridDesktop control.

Thanks.

Hi,

Thanks for your posting and using Aspose.Cells for GridDesktop.

We were able to observe this issue using your sample code with latest version of GridDesktop. Please see the image below for your reference.

GridDesktop displays 10 while Ms-Excel displays 0 as a result.

This issue has been logged as CELLSNET-41518.

Screenshot:

Hi,

Thanks for using Aspose.Cells for GridDesktop.

We have fixed this issue. We will provide you a fix soon.

Hi,

Thanks for your posting and using Aspose.Cells for GridDesktop.

We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.