View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Harvey Schmidlapp Harvey Schmidlapp is offline
external usenet poster
 
Posts: 2
Default Generating Excel XML with embedded char(10)s

I have a Perl script that generates an Excel file in XML. Everything
is working wonderfully except for one column where I want to embed
line feeds in the cells. I know that I want to include chr(10) (which
is the Perl equivalent of char(10) in Excel) for the line breaks. It
appears that the characters are there because when I view the XML file
in a text editor, the contents of those cells are on separate lines
but when I view the file in Excel, the line feed character seems to be
replaced with a single space.

So, for instance, I have:

<Row
<Cell ss:StyleID="S1"<Data ss:Type="String"ABC Corp</Data</Cell
<Cell ss:StyleID="S1"<Data ss:Type="String"John Doe</Data</Cell
<Cell ss:StyleID="S1"<Data ss:Type="String"1234567</Data</Cell
<Cell ss:StyleID="S1"<Data ss:Type="String"Line Number 1
Line Number 2
Line Number 3
</Data</Cell
</Row

But, when opened in Excel, the last cell in the row looks like this:

Line Number 1 Line Number 2 Line Number 3

Wrapping is not turned on for the cell. If I make the column narrow,
it wraps but not where the line feeds are (unless, of course I adjust
it very precisely -- that's not a solution, though because the text
length vary too much from row to row).

Any ideas?