User saves an Excel file, and receives the following error (corrupt file) on opening:
Excel found unreadable content in 'FILENAME.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.
Clicking Yes generates:
Removed Feature: View from /xl/worksheets/sheet1.xml part
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<summary>Errors were detected in file 'FILENAME.xlsx'</summary>
<removedFeatures summary="Following is a list of removed features:">
<removedFeature>Removed Feature: View from /xl/worksheets/sheet1.xml part</removedFeature></removedFeatures></recoveryLog>
The sheet number refers to the codename of the affected sheet. (can be revealed by renaming the file ending .zip and using a zip-extractor to look into /xl/worksheets/)
Gridlines reappear on the affected sheet (if they were originally hidden) and frozen panes are removed.
After much pain and suffering, I have identified a cause that generates this error. It is easily reproducible.
1. Freeze some top rows using freeze panes, e.g. rows 1:6.
2. Move to the bottom of the sheet (using CTRL+down)
3. Use the mouse to scroll down so that you see less rows below the frozen pane than in the frozen pane itself (e.g. show 5 or less rows if you have frozen 6 rows)
4. Save and close the file
5. Open the file and voilá, it is corrupt.
Spreadsheet users may accidentally generate this error especially if the bottom rows are hidden and they use the mouse to scroll down.
The same also happens with frozen columns and moving to the right.
Cause in the code:
Using a text difference editor, I was able to pinpoint the problem.
Not corrupt file:
<sheetView showGridLines="0" zoomScaleNormal="100" workbookViewId="0"><pane ySplit="6" topLeftCell="A7" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft" activeCell="D34" sqref="D34"/>
<sheetView showGridLines="0" zoomScaleNormal="100" workbookViewId="0"><pane ySplit="6" topLeftCell="A1048576" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft" activeCell="D34" sqref="D34"/>
The topLeftCell property of the frozen panes in the corrupt file refers to the last cell in column A, which means that the bottomLeft -property does not have anything to refer to because there is nothing below A1048576
This is a bug in Excel 2010. I don't know of any workaround other than not using freeze panes. The probability of causing the bug is reduced by not hiding the bottom rows (or rightmost columns) of the sheet, because it is unlikely that the user will accidentally scroll to the end of the sheet with the mouse if there are thousands of rows/columns.
This problem appears to have been solved in Excel 2013.