I have a VSTO add-on and am reading data from an Excel worksheet.
It seems that almost all numerical data is read as double. Is it possible to get the value intfrom Range.Value?
Here is some code to demonstrate what I mean.
Worksheet w = (Worksheet)Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets["Sheet1"];
var value = ((Range)w.Cells[1, 1]).Value;
bool isInt = value is int;
bool isDouble = value is double;
No matter what format I use on Sheet Sheet1, cell A1 isIntalways returns false.
Is there any format I have to use to get int? I thought, maybe, Generalor 0will work, but it is not.
source
share