Search code examples
spreadsheetml

speadsheetml invalid when the data contains <>


I noticed that the spreadsheetML will break if the data contains a <> tag inside the data element. For example, the tag below is valid if the data is testing data

<ss:Cell><ss:Data ss:Type="String">testing data</ss:Data></ss:Cell>

The spreadsheetML becomes invalid if the data with <>

<ss:Cell><ss:Data ss:Type="String"><testing data></ss:Data></ss:Cell>

The value is retrieve from database, which is not encourage to be modified. Any thought how to display the data in the Excel file and not break the structure of spreadsheetML?

The expected result in the Excel as below

enter image description here


Solution

  • Solution found.

    Replace the characters < and > to the characters can be recognized by spreadsheetML.

    < TO &lt;     > TO &gt;