C#,Visual Studio 2010中C#访问EXCEL,格式化单元作为通用
当Excel细胞在C#(经由COM对象)操纵,我应该使用。价值或.Value2? 是
sheet.Cells[row + n, col].Value = "Hello world"
或
sheet.Cells[row + n, col].Value2 = "Hello world"
是什么它们之间的区别?
另外,如何设置单元格格式为“常规”?
sheet.Cells[row + n, col].NumberFormat = "XYZ"; // Not sure what should be here
现在,当我分配一个小区甚至如果我做
sheet.Cells[row + n, col].NumberFormat = "@";
我得到这个“小错误”,数字“0.34”,并在每个单元中的左上角注册
感谢您的文章,我现在看到的差异,如果我使用“一般”,我得到的错误“属性NumberFormat不能用于类的范围” –