【发布时间】:2018-05-02 08:15:38
【问题描述】:
我阅读了How to read single Excel cell value 并亲自尝试过。但是当我到达
string s = (myExcelWorkSheet.Cells[3, "E"] as Excel.Range).Value2.ToString();
一切都结束了,表格显示出来了。
//Everything worked fine here.
string s = (myExcelWorkSheet.Cells[3, "E"] as Excel.Range).Value2.ToString();
//Everything after this was all skipped!
为什么会这样,我该如何解决?
【问题讨论】:
-
string s = myExcelWorkSheet.Cells[3, "E"].Value2? -
我确实尝试将 Value2 作为
var首先并将其转换为字符串。但是一旦程序命中它(在转换为字符串之前),整个事情就停止了,并且显示了表单!!! -
Value2作为var?我错过了一些东西。你可以试试string s = myExcelWorkSheet.Cells[3, "E"].Value2吗?