c# - How to best fetch a cell value from excel using VSTO? -
i trying cells excel csharp not sure what's best variable type read into.
if make variable string , cell value double parse error. if make variable double when cell string wont work.
here's code running:
try { string = globals.sheet1.cells[7, 7].value; double num; if (i == null) return; if (double.tryparse(i, out num)) { . . . } } catch (exception e) { messagebox.show(e.tostring()); }
make object, find out right type after have gotten value out of cell.
i don't know vsto, in excel interop assembly, there value2 , text property both returned object, , casted through polymorphism correct type. doesn't vsto provide those?
Comments
Post a Comment