By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Can't read xml to Excel (dataset.WriteXml)

P: n/a
I'm using this code to generate an XML-file:

If File.Exists("d:\k2b.xls") Then File.Delete("d:\k2b.xls")
Dim fs As New System.IO.FileStream("d:\k2b.xml",
IO.FileMode.CreateNew)
dsP.WriteXml(fs)
fs.Close()
fs.Dispose()

When importing to Excel 2000 (10.0) it shows the entire xml-code (as
if opened with text editor). What am I doing wrong?

--
I've posted this question before, but forgot to follow up. Andrew
Morton kindly responded and asked:

"If you save it with an extension of .xls instead, does Excel then
"understand" it?"

The answer is no. The result can be seen at
www.dbconsult.dk/ms/xls.jpg.

/Snedker

Apr 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Morten Snedker wrote:
I'm using this code to generate an XML-file:

If File.Exists("d:\k2b.xls") Then File.Delete("d:\k2b.xls")
Dim fs As New System.IO.FileStream("d:\k2b.xml",
IO.FileMode.CreateNew)
dsP.WriteXml(fs)
fs.Close()
fs.Dispose()

When importing to Excel 2000 (10.0) it shows the entire xml-code (as
if opened with text editor). What am I doing wrong?
"If you save it with an extension of .xls instead, does Excel then
"understand" it?"

The answer is no. The result can be seen at
www.dbconsult.dk/ms/xls.jpg.


Something less than an ideal result :-(

Unless someone has a better idea, perhaps you could save an xml file from
Excel (I only have Excel 2000, so I can't) and have a look at what Excel
expects to see.

Does it help if you use the WriteXml(Stream, XmlWriteMode) method to save
the schema with it?

Or you could write out the data in CSV format and Excel will happily read
that, although I don't know what it'll do with a date in that format.

Andrew
Apr 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.