1

I'm trying to read data in a xlsx file (in C# WPF with spire xls) but when the cell contains a formula I can only get the formula and I don't know how to get the result

I've tried this :

    wb.LoadFromFile("...");
    wb.CalculateAllValue();
    colsheet = wb.Worksheets[6];
    SwitchName = colsheet.Range["B1"].Value;

and with that I get : "=IF(OR(I215=0,J215=0),"",I215+J215-1)" but I want the result and not the formula. How can I do that?

PaulG
  • 13,871
  • 9
  • 56
  • 78
Tib
  • 31
  • 2
  • 8

1 Answers1

1

You should use Object ob = colsheet.Range["B1"].FormulaValue; instead of this line SwitchName = colsheet.Range["B1"].Value;

Dheeraj Malik
  • 703
  • 1
  • 4
  • 8