Megan
Megan

Reputation: 3

When creating an xml document Excel doesn't recognize line breaks

I'm attempting to code XML in MUMPS, for use in Excel. This is my MUMPS code:

s incResStr=incResStr_[newData]+"
"

Basically concatenating data into a string and adding a line break between each new piece. The problem is that when I open it in Notepad++ the XML looks like this:

<ss:Cell ss:StyleID="base">
        <ss:Data ss:Type="String">^^^^^3^ &amp;#10; ^^^^^2521^ &amp;#10; ^^^^^2515^ &amp;#10; ^^^^^107^ &amp;#10; </ss:Data>

Notice the 'amp;' meaning that it's actually converting my & into the actual entity for the &. Then it's not recognizing the #10; as anything useful. Any ideas on how I can prevent it from doing that?

Upvotes: 0

Views: 1544

Answers (1)

Axel Richter
Axel Richter

Reputation: 61915

I suspect you mean SpreadsheetML. Then a SSCCE could be:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <Styles>
  <Style ss:ID="wrapText">
   <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Tabelle1">
  <Table>
   <Row>
    <Cell><Data ss:Type="String">Text with linebreaks</Data></Cell>
   </Row>
   <Row ss:Height="60">
    <Cell ss:StyleID="wrapText"><Data ss:Type="String">This&#10;is&#10;a&#10;test</Data></Cell>
   </Row>
  </Table>
 </Worksheet>
</Workbook>

Note: I have provided a Style element for wrap text and applied this to the Cell with the multiline text.

Upvotes: 2

Related Questions