Is there any way to read the data from formula cell?

Hi Amjad Sahi,

I want to read the data from formula cell, that's is already generated by formula.

Is there any way?

Thanks,

John

Hi John,

Well you can use Cell.StringValue and Cell.Value Properties for your requirement.

Kindly refer the following code with the template xls file (Attached).

Workbook wb = new Workbook();

wb.Open(@"d:\testformula1.xls");

Worksheet dataWs = wb.Worksheets[0];

string strFormula = dataWs.Cells["A3"].StringValue;

MessageBox.Show(strFormula);

dataWs.Cells["A4"].Formula = strFormula;

wb.CalculateFormula();

MessageBox.Show(dataWs.Cells["A4"].Value.ToString());

Regards

Amjad Sahi

Aspose Nanjing Team

Hi Amjad Sahi,

Now I can get the calculated value from formula.

Thanks,

John