How can I repair a corrupted odt file

I was working on a document with my math assignement, regurally saving it. At some point I notice some weird behaviour, when trying to edit one math formulas, its contents were changing to exactly the same as another math object.

I decided to save my work and restart libreoffice, there was no indication that the save failed, but the file now doesn’t open. A pop up window with title “LibreOffice 4.1.3.2” that says “Read-Error Error reading file” without any usefull information about the error. Backup option on Load/Save was not enabled.

I can unzip the odt just fine and run xmllint on the contents.xml, without any errors. It seems I have enough data on the file, but no way to recover any of it. I’ve spent a few hours working on this file, is there any way to recover any part of it? I’m interested only on the math formulas, it’s a huge pain to recreate.

Thanks

UPDATE

In the with the unziped contentes, by running file ObjectReplacements/* I was able to spot which objects are StarView MetaFiles. Renamed them so they end in .svm and now I’m able to import them as pictures in a new document. I can’t edit them, but at least I won’t have to recreate all the formulas manually.

Still interested on how to recover the original file though.

UPDATE2

Finally made it by using the Apache OpenOffice Beta. See answer below.

I searched the web using the string “How can I repair a corrupted odt file”. There are many links. You might find there the needed help. There are even recovery tools offered.

I have already done this. As you can see, I’ve followed a number of steps the average LO user wouldn’t do. I was hoping there was some repair method or utility that could recover most of the document, preferrably, something quicker than re-writting the document from scratch.

I tried opening the file with AbiWord, which succeeded but wasn’t really in a useful format. I could restore the text but I was more interested in restoring my formulas.

I downloaded Apache OpenOffice, both stable 4.0.1 and 4.1.0 Beta. Using the Beta version, when attempting to open the file, I was able to get a more informative error (sub-document content.xml in location 530,75 (row,col)), but even better I was able to insert the corrupted file in a new empty document with all the contents intact except one small formula object.

LibreOffice should be more forgiving and more resilient to these type of issues. My file was almost fully recoverable and I might have ended up re-writting it from scratch.

I tried opening the file with AbiWord, which succeeded but wasn’t really in a useful format. I could restore the text but I was more interested in restoring my formulas.

I downloaded Apache OpenOffice, both stable 4.0.1 and 4.1.0 Beta. Using the Beta version, when attempting to open the file, I was able to get a more informative error (sub-document content.xml in location 530,75 (row,col)), but even better I was able to insert the corrupted file in a new empty document with all the contents intact except one small formula object.

LibreOffice should be more forgiving and more resilient to these type of issues. My file was almost fully recoverable and I might have ended up re-writting it from scratch.

I glad to read that you could recover your file! May I suggest you write an enhancement request here: https://www.libreoffice.org/get-help/bug/?enhancement=yes

Using OpenOffice 4.1.1 worked for me. I am a little disappointed that I had to use OpenOffice to fix LibreOffice. It would be nice if this bug is found, and better error information included.

@tkman, Please file a bug report and attach the file that OpenOffice could fix (and that LibreOffice could not fix). This is one of the best ways for us to improve the software!

Thanks,
–Q