I have a cell with this value : =-3%-1%
and the value property of the cell is null and the formula is =-3%-1%.
Could someone help me with this issue please?
image.png (7.3 KB)
image.png (12.9 KB)
@raha_Hosseini,
We have created a sample file based on the images you provided. We can get the correct results. If you encounter a null pointer exception when calling, you can try calling the Workbook.CalculateFormula() method first. Please refer to the attachment (5.4 KB).
The sample code as follows:
Workbook wb = new Workbook(filePath + "a.xlsx");
wb.CalculateFormula();
Cell a1 = wb.Worksheets[0].Cells["A1"];
Console.WriteLine(a1.Formula);
Console.WriteLine(a1.Value);
Console.WriteLine(a1.Value.ToString());
The output result:
=-3%-1%
-0.04
-0.04
Hope helps a bit.
Thank you so much, yes after calling the calculate method for that cell it works.
It is nice to know that your issue is sorted out by calculating formula(s) first. Should you have further queries or comments, feel free to write us back.
1 Like