I need to take the content of a C# datatable and deposit it (...) in a new Excel spreadsheet. I have seen some good generic code to do this, however, my problem is that I need to be specific, column by column, as to the format of the cells. For example, I need to enforce a rule that certain columns are TEXT only - so that numbers (without leading text) are NOT treated as numeric values.
Typically, when Excel sees '01', it will load the cell as '1' with the leading zero truncated, and, further, right justified as numeric data would be. However, in my example, this would be incorrect, since '01' is a STRING and not a number, and must, therefore, retain the "leading" zero and be left justified.
Therefore, how do I go about specifying the data types for columns in a spreadsheet generated from a C# datatable?
Thanks.
Avrohom