Reputation: 1850
Cell A1 contains value "=A2" Cell A2 contains "Microsoft".
When I access cell A1 through c# I get "Microsoft".
How to access "=A2" value of cell A1?
Microsoft.Office.Interop.Excel.Range cell //it points to address A1
object obj=cell.Value2; //Here obj contains "Microsoft" but I want "=A2"
Upvotes: 4
Views: 1551
Reputation: 14387
Try to use Range.Formula:
Microsoft.Office.Interop.Excel.Range cell //it points to address A1
object obj=cell.Formula;
Upvotes: 4