TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Basit Khan
NA
336
121.6k
Data export from Excel to XML
Jan 30 2018 2:24 AM
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.
Reply
Answers (
4
)
Index was out of range
Listview Updating and Deleting events not working