C# Accessing EXCEL, formatting cell as General -
c#, visual studio 2010
when manipulating excel cells in c# (via com object), should use .value or .value2 ? is
sheet.cells[row + n, col].value = "hello world"
or
sheet.cells[row + n, col].value2 = "hello world"
what difference between them ?
also, how set cell format "general" ?
sheet.cells[row + n, col].numberformat = "xyz"; // not sure should here
right when assign cell number "0,34" , if
sheet.cells[row + n, col].numberformat = "@";
i "little error" sign in left corner in each cell
to answer first question should read article: http://blogs.msdn.com/b/eric_carter/archive/2004/09/06/225989.aspx
the optional parameters part doesn't apply anymore since c# 4.0 has optional parameters.
but there difference (stated in article)
the difference between property [value2] , value property value2 property doesn’t use currency , date data types. can return values formatted these data types floating-point numbers using double data type.
for second question, have tried setting cell 'general' , reading out in code?
i think it's sheet.cells[row + n, col].numberformat = "general"
, "@"
pure text.
Comments
Post a Comment