2017-06-04 66 views
0

我遇到了使用Interop在Excel中设置列格式的麻烦。我使用C#,下面是代码:C#Excel数字格式错误

Excelop.Range rg = (Excelop.Range)wb.Worksheets[1].Cells[1, i]; 
rg.NumberFormat = "@"; //Exception is raised here 

我得到下面的异常编译的时候:

“式的‘System.Runtime.InteropServices.COMException’未处理的异常发生的mscorlib .DLL

其他信息:无法设置Range类”

的NumberFormat属性感谢您的支持。

回答