SpreadsheetML newlines in cells with inlineStr

104 Views Asked by At

I can see in shared strings that newlines are pretty simple:

<si>
    <r>
        <t>First Line
Second Line</t>
    </r>
</si>

But that doesn't seem to translate to inlineStr. This newline is ignored:

<c t="inlineStr">
    <is>
        <r>
            <t xml:space="preserve">First Line
Second Line</t>
        </r>
    </is>
</c>

With and without xml:space="preserve" is the same. Replacing the newline with &#10; is the same. Any ideas how to create a newline in a cell using inlineStr?

2

There are 2 best solutions below

1
Rashmina Amarasinghe On

Did you try using <br> tag?

If it is not working try using CDATA sections within the <t> element.

It indicate to the XML parser that the text within should be treated as character data and not parsed as XML markup.

<c t="inlineStr">
    <is>
        <t><![CDATA[First Line
Second Line]]></t>
    </is>
</c>
3
Ahmed Amin Shahin On
 <t>
 <c r="A1" inlineStr="Line 1<br>Line 2">
 </c>
 </t>

you can also ty

<c t="inlineStr">
    <is>
        <t>First Line&#13;&#10;Second Line</t>
    </is>
</c>