Unable to read Excel (2003) some information

Apr 18, 2013 at 9:37 AM
Edited May 5, 2013 at 10:43 AM
Hi,All.

I am routinely write code, but such problems:

Unable to read Excel (2003) in addition to the pure digital cell information!!

My code:
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
            IExcelDataReader excelReader;
            Regex r = new Regex(".xlsx");
            Match m = r.Match(filePath);
            if (m.Success)
            {

                //2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
                excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                //...
            }
            else
            {
                //1. Reading from a binary Excel file ('97-2003 format; *.xls).
                excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
                //...
            }
            //3. DataSet - The result of each spreadsheet will be created in the result.Tables
            //DataSet result = excelReader.AsDataSet();
            //...
            //4. DataSet - Create column names from first row
            //excelReader.IsFirstRowAsColumnNames = true;
            DataSet ds = excelReader.AsDataSet();

            //5. Data Reader methods
            if (excelReader.Read())
            {
                //excelReader.GetInt32(0);
                dgv_Data.DataSource = ds.Tables[1];
            }

            //6. Free resources (IExcelDataReader is IDisposable)
            excelReader.Close();
Thanks advance!
Apr 25, 2013 at 12:11 PM
I didn't quite understand what the problem was. Can you give me some more information? Maybe a stack trace if there is an exception?
May 17, 2013 at 4:29 AM
the problem is that

when I import 2003excel file use CreateBinaryReader() and set (or not set) IsFirstRowAsColumnNames true,all can't show some special type of data in the excel

those data such as :x1,x2,x3,x4 (Numbers and letters with the format)
May 22, 2013 at 9:25 AM
Can you create an issue and upload an example spreadsheet that exhibits this problem