Bug 68543 - FILEOPEN: LO calc file not opening. Read-Error. Format error discovered in the file in sub-document content.xml
Summary: FILEOPEN: LO calc file not opening. Read-Error. Format error discovered in th...
Status: RESOLVED DUPLICATE of bug 65363
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.6.7.2 release
Hardware: Other macOS (All)
: highest normal
Assignee: Vaibhav
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-25 19:51 UTC by retired
Modified: 2014-10-24 19:59 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Office file can't open (175.67 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-10-24 14:47 UTC, Vaibhav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description retired 2013-08-25 19:51:47 UTC
Problem description: A file is not opening with LO 4.2, 4.1.1.1 nor 3.6.7.

Steps to reproduce: I can't really attach the file since it contains sensitive data and since I can't open the file I can't erase that data and attach the file for further testing.

Current behavior: Lo 4.2 spits the following error msg:
Read-Error.
Format error discovered in the file in sub-document content.xml at 2,71736(row,col).

When testing the file with http://opendocumentfellowship.com/validator the following results are shown:

This file is not Valid OpenDocument 1.0!
ERROR
in content.xml
/content.xml:2: parser error : Attribute office:currency redefined
ERROR
in styles.xml
/www/TOM/_temp/KjixTwijWPPRsmy31sjnfWJsatZ5KOxN/styles.xml:0: Relax-NG validity error : Did not expect element header there
/www/TOM/_temp/KjixTwijWPPRsmy31sjnfWJsatZ5KOxN/styles.xml:0: Relax-NG validity error : Element master-page has extra content: header
Relax-NG validity error : Extra element master-page in interleave
/www/TOM/_temp/KjixTwijWPPRsmy31sjnfWJsatZ5KOxN/styles.xml:0: Relax-NG validity error : Element master-styles failed to validate content


Expected behavior: Open the file.

Thankful for any ideas or solutions to this. This file is important for my work. Hope I can recover it somehow.

              
Operating System: Mac OS X
Version: 3.6.7.2 rc
Comment 1 Zeki Bildirici 2013-08-25 21:40:06 UTC
Hi,

I've faced this before. 

Change the file extension to zip and extract it. 

Open the content.xml with Emacs or other XML editors showing errors, carefully delete the error giving tags save it and re-zip the extraction. Rename the zip extension to ods.

You may find similar solutions on internet.

If you cannot recover, you may send the file to me and i can try(probably tomorrow night).

Best regards,
Zeki
Comment 2 retired 2013-08-25 23:03:43 UTC
Hey Zeki,

thanks already so much for your fast reply. I don't have any experience at editing xml files. But I got to the Content XML file, opened that with an XML editor and the problematic cell is the following:

<table:table-cell table:style-name="ce36" office:value-type="currency" office:currency="EUR" office:value="55.69" calcext:value-type="currency" office:currency="EUR"><text:p>€ 55,69</text:p></table:table-cell>

The place which LO seems to have issues with is where I typed "HERE":

<table:table-cell table:style-name="ce36" office:value-type="currency" office:currency="EUR" office:valueHERE="55.69" calcext:value-type="currency" office:currency="EUR"><text:p>€ 55,69</text:p></table:table-cell>

Not sure what to delete or correct. Do you have an idea?
Comment 3 Maxim Monastirsky 2013-08-26 05:11:54 UTC
@James: You have office:currency="EUR" twice, so you should delete one of them.
Comment 4 Maxim Monastirsky 2013-08-26 05:23:23 UTC
@James: Also, please inform in which version did you save the spreadsheet last time, so we can try to reproduce it.
Comment 5 retired 2013-08-26 09:55:29 UTC
Maxim, I tried removing the first entry of office:currency="EUR". Saving that xml and compressing everthing back to zip then renaming to ods file format.

When then opening the file I get:

General Error: General input/output error.

Then I tried the same procedure but this time removing the second entry of office:currency="EUR". The result is identical.

I honestly don't recall which version I last saved the file in. Since I do a lot of LO testing I switch versions rather frequently and go along with pre-releases / master build. Could have been anything between 3.6 and 4.1.
Comment 6 retired 2013-08-26 09:58:22 UTC
For what it's worth I again ran the validation test on the changed file and now get:

This file is not Valid OpenDocument 1.0!
WARNING
does not contain a /mimetype file. This is a SHOULD in OpenDocument 1.0
ERROR
does not contain a manifest.
ERROR
content.xml is missing
ERROR
styles.xml is missing

So looks much better, but still not opening.
Comment 7 Maxim Monastirsky 2013-08-26 11:16:56 UTC
(In reply to comment #6)
> So looks much better, but still not opening.
No, It's worse. Seems that you didn't compress the zip correctly, as the validator clearly stated that your zip is missing some files. Another possibility is that the directory hierarchy inside the zip is wrong, or the zip compressed with some compression method which LO doesn't support.
Comment 8 Maxim Monastirsky 2013-08-26 12:10:48 UTC
@James: You can find the version of LO that was used to save the spreadsheet, in the meta.xml file.
Comment 9 Maxim Monastirsky 2013-08-26 12:23:14 UTC
@James: Isn't it a duplicate of Bug 65363?
Comment 10 Maxim Monastirsky 2013-08-26 13:39:31 UTC
@James: Just tried to repair a similar corrupted spreadsheet by removing the duplicate office:currency entry, and I succeed. Now the spreadsheet opens by LO without problem. Sure you're doing something wrong. So if you stuck, feel free to ask.

*** This bug has been marked as a duplicate of bug 65363 ***
Comment 11 retired 2013-08-26 17:14:09 UTC
Updating this with some info and good news: FILE IS WORKING AGAIN! :)

Super-happy.

If anybody runs into a similar problem here are the steps that worked for me:

1) Open a Terminal and navigate to the folder where you keep the corrupted ods.
2) Now create a new folder named 'repair' and cd to it:
 mkdir repair
 cd repair/
3) Now extract the files with the following command:
 unzip ../corrupted.ods
4) The folder 'repair' now contains several files & folders, including 'content.xml' which you should edit (you don't need a special XML editor, you can use every text editor). DON'T touch the other files in that directory!
5) Now we're going to create the repaired file:
 zip -r ../repaired.ods ./*

I had to find & replace a ton of entries and make sure to only delete every second entry (which was causing the problem in the first place.

To Maxim, Jorendc, Reisi007 and Zeki: you guys have been super responsive and I'm really thankful that you all were willing to help me out.

This is a great community! :)
Comment 12 Zeki Bildirici 2013-10-02 13:15:47 UTC
(In reply to comment #11)
> Updating this with some info and good news: FILE IS WORKING AGAIN! :)
> 
> Super-happy.
> 
> If anybody runs into a similar problem here are the steps that worked for me:
> 
> 1) Open a Terminal and navigate to the folder where you keep the corrupted
> ods.
> 2) Now create a new folder named 'repair' and cd to it:
>  mkdir repair
>  cd repair/
> 3) Now extract the files with the following command:
>  unzip ../corrupted.ods
> 4) The folder 'repair' now contains several files & folders, including
> 'content.xml' which you should edit (you don't need a special XML editor,
> you can use every text editor). DON'T touch the other files in that
> directory!
> 5) Now we're going to create the repaired file:
>  zip -r ../repaired.ods ./*
> 
> I had to find & replace a ton of entries and make sure to only delete every
> second entry (which was causing the problem in the first place.

That's why i suggest you to use EMACS to mark XML Errors automatically and you may easily delete the error giving lines. Next time try it (i hope you will not face it again) ;)
 
> To Maxim, Jorendc, Reisi007 and Zeki: you guys have been super responsive
> and I'm really thankful that you all were willing to help me out.
> 
> This is a great community! :)

Thanks, thats the community :)
Comment 13 Vaibhav 2014-10-24 14:47:04 UTC
Created attachment 108355 [details]
Office file can't open
Comment 14 retired 2014-10-24 19:59:45 UTC
Vaibhav: if you still run into trouble, please open a new bug since this bug here is already closed as a duplicate of another already closed bug.