why this with excel sheet reading?

Posted by Lalit on Stack Overflow See other posts from Stack Overflow or by Lalit
Published on 2010-05-14T10:39:47Z Indexed on 2010/05/14 10:44 UTC
Read the original article Hit count: 174

Filed under:

Hi, I am reading the excel sheet from c# interop services cell by cell. where as my excel sheet have Date cells. It generates some double values , I am converting them in date by :

 double dbl = Convert.ToDouble(((Excel.Range)worksheet.Cells[iRowindex,                colIndex_q17]).Value2);
                        string strDate3 = DateTime.FromOADate(dbl).ToShortDateString();
                        drRow[dtSourceEXLData.Columns[constants.VisualDate]] = strDate3;

ok? but some time happening the value of

((Excel.Range)worksheet.Cells[iRowindex,colIndex_q17]).Value2

getting date formate.why this is happeing? plaease guide me. it throws excepion of "input string not in correct format".why it is not generating double value like other cell of same column?

© Stack Overflow or respective owner

Related posts about excel