Free Support Forum - aspose.com

How I can read a value in a cell with formula from an existing excel file

Hi

How I can read a value in a cell with formula (I’ve gat a1=4, b1=4 and c1=a1+b1) from an existing excel file.

I can’t read the value of cell c1.

Her is the code (asp.net,c#) that I’m using:



Excel excel = new Excel();

string path = MapPath(".");

path = path.Substring(0, path.LastIndexOf("\"));

string designerFile = path + “\Designer\Book1.xls”;



excel.Open(designerFile);

Cells cellsSheets1 = excel.Worksheets[0].Cells;

Response.Write(“Count cells in af Worksheets :”+excel.Worksheets[0].Cells.Count);

//get value

Response.Write(" Get af value at a1 :"+cellsSheets1.GetAt(“a1”).IntValue);

Response.Write(" Get af value at b1 :"+cellsSheets1.GetAt(“b1”).IntValue);

Response.Write(" Get af value at b1 :"+cellsSheets1.GetAt(“c1”).IntValue);

I’m having problem with the last line.

Best regards

Daniel

Hi Daniel,

Would you send your Book1.xls file to excel@aspose.com?

You’re encouraged to post here further.

Thanks for your cooperation.

Dear Daniel,

I understand your problem.
Because it’s hard to do calculation based on Excel function. Aspose.Excel don’t calculate the formula and get the result value. To meet your need, I will try to some modification in Aspose.Excel.
But to keep the version consistency, you will get the hotfix till 10/15.
And the designer file should be created by Microsoft Excel.