5

I generate my spreadsheet with xslt and want a cell with wrapped text (or better: a text with a line break in it).

So my xslt generates the following XML for the sheetdata:

<sheetData>
  <row r="1">
    <c r="A1" t="inlineStr">
      <is>
        <t>
          a simple string
          line break jeeeehaaa
        </t>
      </is>
    </c>
  </row>
</sheetData>

After I'm finished building my Workbook, I open it in Excel; and there's no line break, just a simple one-line string in A1.

has anyone a solution to this? Doesn't have to be in xml or xslt (but would be nice). I could also do some things in c#

Sildoreth
  • 1,883
  • 1
  • 25
  • 38
domueni
  • 304
  • 8
  • 19
  • This doesn't look like SpreadsheetML. This looks like Office Open XML. See [Microsoft Office XML Formats](https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats) for a description of the differences. – Sildoreth Jun 25 '15 at 13:20

1 Answers1

6

In excel, all style related information is stored in style.xml file. So, the wrapping information should be stored in style.xml and the style Id should be referred in <c r="A1" t="inlineStr"> as one more attribute 's' (which means style). Let me show what do I mean by this..

I do have an excel with some text and the cell is wrapped indeed.

If I see its sheet.xml data it would have s="1" attribute-value item in <c> tag.

So, if I open style.xml and see the cell style info I'll get <cellXfs> tag and a <xf> child tag where I get a <alignment> tag with wrapText attribute with value as "1" ("true" indeed).

I'm unable to post images since I'm new to SO. Hope this helps :)

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Pramod
  • 72
  • 3