Geneate XML file from Excel Worksheet----Urgent Help me Pls
-
Dear All,, Can U Help me to Generate the XML document from Excel Worksheet.Excel 2003 professional Edition have an option like XML in Data Menu..I have Excel 2003 Standard Edition... Please Help me to get the Solution Thanks n Regards, Ramya.R -- modified at 0:01 Friday 24th February, 2006
-
Dear All,, Can U Help me to Generate the XML document from Excel Worksheet.Excel 2003 professional Edition have an option like XML in Data Menu..I have Excel 2003 Standard Edition... Please Help me to get the Solution Thanks n Regards, Ramya.R -- modified at 0:01 Friday 24th February, 2006
You can use dataset.GetXml method to get the xml private const string xcel_CONN_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;"; internal DataSet GetExcelDataToDataSet(string filepath, string sheetname) { OleDbConnection cn = null; OleDbDataAdapter da = null; DataSet ds = null; try { cn = new OleDbConnection(string.Format(xcel_CONN_STRING, filepath)); cn.Open(); da = new OleDbDataAdapter(string.Format(xcel_sql, sheetname), cn); ds = new DataSet(); da.Fill(ds); return ds; } catch (Exception ex) { throw new Exception(ex.Message); } finally { if(cn != null) { cn.Close(); cn.Dispose(); } } }