Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
DateTime format problem
posted

I think i found a problem with DateTime Cells and Excel2007 workbook format. This problem occur only if you reWrite data on an existing worksheet. In this case the date format is lost and you have to select all datetime cells on Excel to set their format to Date and get the right date format.

Writing same data in a new worksheet doesn't lost the date format.

if the worsheet exist :

workBook.Worksheets.Remove(workBook.Worksheets[worksheetName]);
worksheet = workBook.Worksheets.Add(worksheetName);

Initialize all cells from a database, the datetime format is lost

If the worksheet doesn't exist
worksheet = workBook.Worksheets.Add(worksheetName);

The datetime format is ok

This problem doesn't occur for Excel2003 format.

Best regards

Florent, French

Parents Reply Children