0
Reply

Convert Excel 4.0 into recent Excel Version in C#

philippe.alet

philippe.alet

Nov 24 2004 4:24 AM
2.3k
I need to import in my win form appli some Excel files created in Excel 4.0 and I don't control this export format origin. I tried many way to use ODBC adapters to import these data but it works only for Excel 2000 and above. I am looking: 1: A code/program/utility than convert Excel 4.0 in Excel X.X version (recent) or 2: Modify the code of my ODBC adapter to support Excel 4.0 file (see current code below In addition, do anybody know how we can get the excel version of a file in C# ? Thanks for your help Mikels Code: string strFilename = openFileDialog1.FileName; string ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFilename + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\""; OleDbConnection Connectxls = new OleDbConnection(ConnectString); OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$B1:O250]", Connectxls); DataTable RawData = new DataTable(); Connectxls.Open(); myCommand.Fill(RawData);