Formatting date format to text(string) format

hi,
i am getting date format into dataset. when i am using excel.ImportDataTable that date format is comming to that hole column values. but i want that (total column values) to be string.

how to do that t string format from date format

Hi,

Could you give us details, which overloaded version of Cells.ImportDataTable() method you are using. Do you use Cells.ImportDataTable( dataTable, isFieldNameShown, firstRow, firstColumn, rowNumber, columnNumber, insertRows,
dateFormatString ). And when you convert a datatime format to string, the datetime values would be converted to numeric values e.g., for datetime....4/2/2008, when you convert it to text, it will be 39540 numeric value.

You can format a complete column for your desired formattings after you have imported data. You may achieve in the way as follows:

Workbook wb = new Workbook();

wb.Open(filepath);
Worksheet sheet = wb.Worksheets[0];
sheet.Cells.ImportDataTable(..............);

..........

Style style;
StyleFlag flag;
style = wb.Styles[wb.Styles.Add()];
style.Custom = ......;
flag = new StyleFlag();
flag.NumberFormat = true;
//Apply style to the 5th column.
sheet.Cells.ApplyColumnStyle(4,style, flag);
wb.Save("d:\\test\\style_column.xls");

Thank you.