Thursday, 14 May 2009

Export String Values To Excel 2007

If you encounter a following error, while exporting to Excel 2007 (.xlsx)

Errors were detected in file MyFileName.xlsx. Repaired Records: Cell information from /xl/worksheets/sheet1.xml part

then, probably, you are exporting string values in wrong format. The right structure in this case is

<sheetData>
  <row>
   <c>
     <v>99999</v>
   </c>
   <c t="inlineStr">
     <is>
       <t>My Text</t>
     </is>
   </c>
  </row>
</sheetData>

Note, that there is no <v> tag in <c> as it should be with numbers. Instead you have to make an inline string (<is>) tag and put text (<t>) tag with needed text in it. Do not forget to add the t="inlineStr" attribute to <c> tag.

More info can be found developer:network.