Worksheet get_Range throws exception

后端 未结 4 1837
一整个雨季
一整个雨季 2020-12-13 19:09

I\'m using C# to manipulate an Excel worksheet. The following two pieces of code should work the same, but one works and the other throws an exception. I wonder why.

4条回答
  •  别那么骄傲
    2020-12-13 19:40

    For everyone who have this problem, much better use explicit conversion, rather than create new variables.

    oRange = (Excel.Range)oSheet.get_Range((Excel.Range)oSheet.Cells[1, 1], (Excel.Range)oSheet.Cells[4,4]);
    

提交回复
热议问题