473,508 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
1 2289
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4486
by: jk | last post by:
I need help in writing a datatable as xml in an aspx page. I have an excel client that opens the response as a stream into a recordset. In converting this code to .net c# from asp vb (where is used...
3
1917
by: Serdar C | last post by:
hello there, i am writing a program that generates random numbers and shows the numbers on a (x,y) chart.. i decided to use crystal reports to draw the chart and a dataset.readxml to read data.....
0
1051
by: cmay | last post by:
Problem: When impersonation is set in the web.config file, I cannot establish an OLEDB connection to the database from my ASP.NET v1.1 application. (Unspecified Error. Stack trace shows it...
1
377
by: Morten Snedker | last post by:
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) ...
2
2660
by: UJ | last post by:
It appears when you do a DataSet.WriteXml ( <filename>, <writemode> ) it doesn't close the file immediately. Is that true ? The reason I think that is I have two programs that are going to be...
0
1234
by: Ashish Tiwari | last post by:
Can i read excel file into asp.net 2.0
12
4229
by: Rainer Queck | last post by:
Hi NG, I have no idea why, but since a while a dataset refuses to write to a specific xml file. I get the error message "Der Zugriff auf den Pfad...
1
5016
by: cindy7 | last post by:
how can i read excel data and import into sql using cfm??? I have a CFM form for user to import excel file into database and save file in the folder at server location. I would like to read that...
4
2029
by: deepaks85 | last post by:
Dear Friends, I need to read an excel data through PHP to web page with formatting. It should be automatically updated on the web page when I updated the excel file. I did research on google...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.