Previous post:

Next post:

Recovering data from corrupted files in OpenOffice documents

January 1, 2006

in All Articles,Backup,Books and documents,Miscellaneous

So you’ve been using and you have a corrupted file in programs like Base, Calc, Draw, Impress, Math or Writer. You might see scary error messages like these:

Format Error discovered in the file in sub-document styles.xml at 2,2568(row,col)

The file ‘file.odt’ is corrupt and therefore cannot be opened. Should repair the file?

The file ‘file.odt’ could not be repaired and therefore cannot be opened.

General Error.
General input/output error.

A little intimidating, and not good to see. Try the following to recover OpenOffice data (and make sure you have a backup of the original problem file, just in case):

1) Restore from backup, if one exists.

2) Do you have the latest version of installed? If not, download it, install it, and try to open the file again.

3) Insert the file. Open a blank file in OpenOffice. Go to the “Insert -> File” menu and insert your corrupted file. (For spreadsheet, Calc or ODS documents, instead use the “Insert -> Sheet from File” menu option.)

4) Find backups. If you’ve checked the “Always create backups” in the OpenOffice settings, keeps backups of all your files at this location:

C:\Documents and Settings\USERNAME\Application Data\\user\backup

Browse to that location and see if your file is there. It will have the same filename as your original, only with a .BAK extension. Copy it somewhere else and open it with OpenOffice.

5) Rename as a ZIP file. Change the extension of your document from whatever it is (like ODT, ODS, ODP, ODG, ODB, ODF) to a ZIP extension. Then open the file using Microsoft Windows or WinZip. If you’re lucky, you’ll see a bunch of files contained in this newly-created Zip file. One of them is called “content.xml“. Open this file with any text editor, and you may find your document text. It will have a bunch of formatting statements you’ll have to delete, but the actual text should be there too. Alternatively, you can try deleting the “styles.xml” document, rename the file back to an extension, and try opening the file as normal. Sometimes removing the styles.xml from the document does the trick.

6) Look in your Temp directory. In Windows, browse to this folder:

C:\Documents and Settings\USERNAME\Local Settings\Temp

This will probably be a pretty messy place, and lots of the folders and files have meaningless names, but sort the results by the “Date Modified” column and look at the results. Look for files and folders that were last modified on the date and time you last had a working file. For each file (look in sub-folders too), perform the steps in option 4, above: Rename the file with a ZIP extension and try to open the resulting “content.xml“.

7) Text string search: Run a search on your entire computer. Search all files, and search for a unique phrase or word you are sure is contained in your document text.

Readers Respond

It’s great to know these instructions are helping others, and thanks for letting me know! I originally designed this page after doing lots of research on my own, as I thought I had lost an document myself. Researching showed me no single place offering step-by-step instructions for document recovery, so this page was born. I’m glad others are benefiting from it.

Michael says:

I am so excited; I just had to e-mail you. I recently prepared an image-heavy document for school in OpenOffice. I saved it, but it just wouldn’t open. I followed the instructions for recovering corrupt .odt files, and I only got to step 3. It opened, and you saved me so much work. It would have taken several hours for me to recompile my information. Thanks a LOT.

Javier says:

Thanks very much for your help with Open Office recovery. I recovered a couple days’ work that I had almost given up as lost.

Bart says:

Your instructions about how to recover a odf document helped me very much. It saved me a lot of time remaking my presentation.

Diogo says:

I just reached the above link trying to fix a .ods file (Calc).. I did manage to fix it, a friend of mine would have lost a LOT of work if I didn’t. So thank you very much!

I’m emailing because I managed to fix it using the zip, but in a different way. Maybe you can put that on your page to help other people. The important file is “content.xml”, and that file was corrupted (CRC error), in windows I couldn’t even extract it. I sent the file to a box with linux, and i managed to unzip it even with the CRC error (maybe there is an option in the zip programs to ignore CRC errors, I don’t know). Sent it back and put it back in the zip and renamed the file. Worked perfectly. Point is: juggling a little more with the zip might prove very useful.

Previous post:

Next post: