Hi,
I wrote the below code to export data from excel to xml, but in excel file if column cell is empty then in xml that column/element is not showing.
i want whereever empty cell in xml should show as 0
- Private Function exportExceltoXML(ByVal excelPath As String) As String
- Dim cnExcel As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelPath + ";Extended Properties=Excel 12.0;")
- cnExcel.Open()
- Dim ds As New DataSet
- Dim da As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", cnExcel)
- da.Fill(ds)
- cnExcel.Close()
- Dim sXML As String
- sXML = ds.GetXml()
- ds.WriteXml(TextBox1.Text & "\Trn_Daily3.xml")
- ds.Dispose()
- da.Dispose()
- MsgBox("Exported successfully")
- Return sXML
- End Function
Thanks
Basit.