View Single Post
  #2   Report Post  
smeadows smeadows is offline
Junior Member
 
Posts: 1
Default

I have experienced this same issue and finally found a solution although I do not know why the solution worked. Ultimately I believe the problem lies in a corrupted XML file in the .xlsx file but I do not know why or how the corruption was created. I believe the corruption is located in styles.xml.

I compared the xml files in the \xl\tables\ folder with the xml files in the \xl\tables\ folder of a .xlsx file that does not exhibit the behaviour you describe.

I then removed a single value/pair (specifically the headerRowCellStyle="Normal 2") from

<<<<<<
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="3" name="Table3" displayName="Table3" ref="A6:T21" totalsRowShown="0" headerRowDxfId="65" headerRowBorderDxfId="64" tableBorderDxfId="63" totalsRowBorderDxfId="62" headerRowCellStyle="Normal 2"
<<<<<<

To produce

<<<<<<
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="3" name="Table3" displayName="Table3" ref="A6:T21" totalsRowShown="0" headerRowDxfId="65" headerRowBorderDxfId="64" tableBorderDxfId="63" totalsRowBorderDxfId="62"
<<<<<<

then saved the table1.xml file back into the .xlsx file and the workbook now allows me to copy the offending worksheet to a <new book or any other workbook without crashing Excel.

I then created a new .xlsx file and copied the styles.xml file from the clean copy to overwrite the styles.xml file in the problematic file. When I subsequently tried to open the problematic file, Excel detected the corrupt information in the problematic file, removed it and now the workbook worked correctly. NOTE: Removing the "styles.xml" file is a method of last resort (only to be used if you cannot find the specific .xml files that contain bad references) since this action will remove all formatting you have created and used in your file.


If you are not familiar with how to extract the .xml files from a .xlsx file format, the simplest way is to rename the file with a .zip extension (on Windows7) then open the zip file, copy the specific table.xml files to any local directory, edit the .xml files, then copy (overwrite) them back into the .zip (renamed) file and remove the .zip extension from your original .xlsx file. For more info, see Wikipedia on OOXML <http://en.wikipedia.org/wiki/Office_Open_XML

excerpt: "An Office Open XML file is a ZIP-compatible OPC package containing XML documents and other resources. That is, one can see the contents of an OOXML file, for example by renaming it to a .zip file and opening it with any zip tool. The actual .xml files can then be viewed in a web browser or a plain text editor."

Last edited by smeadows : March 17th 12 at 12:48 AM Reason: Further investigation