Friday, January 7, 2011

Excel Cell Formating

A little reference Gem about formatting cell values, related to my post about Exporting to Excel.

On occasion the format of the Cell will need to be specified. In my case I needed to preserve leading zeros on the record.

Evidently I don’t know the right search terms to find out where this is documented but after a rather long search I found that to get the text format I needed to use cell.NumberFormat = "@";

Many Thanks to today4me over at dreamincode.net http://www.dreamincode.net/code/snippet1218.htm for posting this little guide on formatting. I would have never guessed the @ symbol for the format.

No comments: