How Can I Dynamically Format Columns?

Jan 2, 2013 at 7:21 PM

Hi all,

Is there a way I can dynamically format columns in a spreadsheet based on the datatype of a DataTable? Once I've exported the contents of a database table into a spreadsheet, I would like to iterate through each column of a DataTable (loaded from a database table) and map its datatype to an arbitrary Excel format type so I can do a ws.Column(col).Style.Numberformat.Format = ... on-the-fly.

e.g. a DATE column from a DB table would be mapped to m/d/yy, DECIMAL would be mapped to 0.00, VARCHAR would be mapped to General, etc.

Any assistance would be appreciated! Thank you :)