This project has moved and is read-only. For the latest updates, please go here.

Excel found unreadable content (/xl/SharedStrings.xml).

Apr 27, 2013 at 4:49 PM
I created a fairly simple spreadsheet and Excel complains that it has found unreadable content when I open it. If I proceed with recover it reports "Repaired records: string properties from /xl/SharedStrings.xml".

When I have a look at SharedStrings.xml it initially looks like the culprit is an incorrect count attribute on the sst tag (but read all the way to the end!) The saved version has:
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="7" uniqueCount="7">
whereas the repaired one has:
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="8" uniqueCount="7">
It does look like one of the shared strings is referenced twice in the worksheet.

More curiously, this only started happening when I tried to format the cells to the right of the ones containing the string defined in SharedStrings.xml as RichText. I've narrowed it down to a code path where it executes:
                ExcelRange cell = _dirSheet.Cells[_nextRow, col];
                cell.IsRichText = true;
                ExcelRichText rt = cell.RichText.Add(str1);
                rt = cell.RichText.Add(str2);
When str1 is the empty string this error occurs - even in a spreadsheet with 1 header row and two detail rows (each with the same string in one column). When RichText.Add(str1) is only called when str1 is not empty the error has not yet occurred.

If I reduce the test case to a single detail row Excel still complains with the same error message and the same report about fixing /xl/SharedStrings.xml. However the sst tag's counts are now correct. Here is the entire unrepaired SharedStrings.xml file (indented for clarity):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="6" uniqueCount="6">
  <si>
    <t>Size</t>
  </si>
  <si>
    <t>Ext</t>
  </si>
  <si>
    <t>Name</t>
  </si>
  <si>
    <t>csv</t>
  </si>
  <si>
    <t>.txt</t>
  </si>
  <si>
    <d:r xmlns:d="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
      <d:rPr>
        <d:sz val="11" />
        <d:rFont val="Calibri" />
      </d:rPr>
      <d:t xml:space="preserve"></d:t>
    </d:r>
    <d:r xmlns:d="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
      <d:rPr>
        <d:sz val="11" />
        <d:color rgb="FF000000" />
        <d:rFont val="Calibri" />
      </d:rPr>
      <d:t xml:space="preserve">a</d:t>
    </d:r>
  </si>
</sst>
This is the repaired version:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="6" uniqueCount="6">
  <si>
    <t>Size</t>
  </si>
  <si>
    <t>Ext</t>
  </si>
  <si>
    <t>Name</t>
  </si>
  <si>
    <t>csv</t>
  </si>
  <si>
    <t>.txt</t>
  </si>
  <si>
    <t>a</t>
  </si>
</sst>
So it looks like there is probably one bug (maybe two).