Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML or possibly Text encoding problem in excel!

Status
Not open for further replies.

andypandyswe

Programmer
May 4, 2005
17
SE
Hi,
I've got a datagrid that i want to write to an xml -file (in the code) that will later be opened in excel.

I've created an excel -file that looks like the result I want to get, then saved it as an XML -file (exceloutput.xml) and opened it in notepad to see what it looks like.

I've then written the code that writes the datagrid to a file called myoutput.xml that looks exactly like (at least in notepad) the one excel generated (exceloutput.xml).

In exceloutput.xml (when opened in excel) I have four different values in each cell, one on top of the other. When you open it in notepad excel has put an "&" followed by "#10;" (ampersand, sharp, ten, semicolon)inbetween each value which I guess is a linebreak (I can't write them together in this topic -form because they disappear when I preview my question). It might look something like this:

Code:
...
<Cell ss:StyleID="s21">
<Data ss:Type="String">
value1&#10;value2&#10;value3&#10;value4
</Data>
</Cell>
...

However when i replicate this code in my own myoutput.xml and open it with excel, the values don't end up on top of eachother but in a line after oneanother with a small square inbetween them!

Anyone smart out there who knows why this is and how I can fix it?
If so, thanks a million in advance.

Andreas

P.s.
I've opened exceloutput.xml from within my app and asked it what encoding it is and it says UTF8. I've then tried to set my own file (myoutput.xml) to UTF8 also but the problem remains!
D.s.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top