我正在尝试在 MUMPS 中编写 XML 代码,以便在 Excel 中使用。这是我的 MUMPS 代码:
s incResStr=incResStr_[newData]+" "
基本上将数据连接成字符串并在每个新片段之间添加换行符。问题是,当我在 Notepad++ 中打开它时,XML 看起来像这样:
<ss:Cell ss:StyleID="base">
<ss:Data ss:Type="String">^^^^^3^ &#10; ^^^^^2521^ &#10; ^^^^^2515^ &#10; ^^^^^107^ &#10; </ss:Data>
注意“amp;”这意味着它实际上将我的 & 转换为 & 的实际实体。那么它就无法识别#10;作为任何有用的东西。关于如何防止它这样做有什么想法吗?
我怀疑你指的是 SpreadsheetML。那么 SSCCE 可能是:
<?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 is a test</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
注意: 我提供了一个用于换行文本的
Style
元素,并将其应用到具有多行文本的 Cell
。