[Hint] How did I fix my ODT file

Discuss the word processor
oceanTheOne
Posts: 2
Joined: Tue Dec 13, 2011 12:08 pm

Re: [Hint] How did I fix my ODT file

Post by oceanTheOne »

Hi,

I've lost and tried to recover my work too, but nothing happend. Content.xml seems not corrupted, can someone help me?
File is attached.

Thanks
Attachments
Etiketler.ods
(80.49 KiB) Downloaded 5844 times
Openoffice 3.3, Libreoffice 3.4
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

Try this one:
Last edited by acknak on Tue Dec 13, 2011 9:45 pm, edited 1 time in total.
Reason: attachments removed
AOO4/LO5 • Linux • Fedora 23
oceanTheOne
Posts: 2
Joined: Tue Dec 13, 2011 12:08 pm

Re: [Hint] How did I fix my ODT file

Post by oceanTheOne »

acknak wrote:Try this one:
You are greatt!!

How did you fix it?
Openoffice 3.3, Libreoffice 3.4
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

It only required a few minor adjustments to the content.xml file using a text editor; there was no data corruption.

I presume it's just a bug in the software that gets triggered in certain cases.

A good backup copy is the best way to avoid it ;-)
AOO4/LO5 • Linux • Fedora 23
dahaoleboy
Posts: 3
Joined: Fri Dec 16, 2011 5:44 am

Re: [Hint] How did I fix my ODT file

Post by dahaoleboy »

When I try to open my file, all I get is the following error message:
"READ-ERROR. Format error discovered in the file in sub-document content.xml at 2,1062014 (row,col)."

I've over a week of many, many hours creating 2 custom sheets ( Daily Expenses, Yearly Expenses ) within the file that I would very much like to not lose. I know nothing about how to try the recovery performed by acknak in the primary situation I'm submitting this reply to.

My file is too big to be attached to this e-mail, per the error message I got when I tried, so... would you please submit to me the step-by-step process of repair? I'm not an experienced troubleshooter of such problems.

LibreOffice 3.4.4 on XP = my system.

Thank you for any assistance you may choose to offer.

p.s.: My back-up copy has the same problem... !!!

E-mail removed, nobody will reply by mail and it will avoid spam bots to register your address (Hagar, Moderator).
LibreOffice 3.4.4 installed on XP
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Hint] How did I fix my ODT file

Post by Hagar Delest »

Step by step instructions have been given in this topic. You need a good XML parser (I use XML Copy Editor) and find the wrong tag.
If you can't attach a file, use a 3rd party site like mediafire, as many have done in this topic.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
dahaoleboy
Posts: 3
Joined: Fri Dec 16, 2011 5:44 am

Re: [Hint] How did I fix my ODT file

Post by dahaoleboy »

Never mind... just delete my inquiry. I copied the content.xml file to content-xml.txt, opened that file in notepad, couldn't make heads-nor-tails out of what I was looking at, so opened the file using LibreOffice SWriter 3.4.4 & wound-up with a 437 page monster file. I still can't understand what I'm looking at, nor for, so have abandoned a full week's ( every possible minute ) work & am restarting the file creation in SCalc, without starting-off by adding into an existing file, like I did before. This way, the file won't be over 400KB in size to start.

Thank you for getting back to me, Hagar, but I wouldn't even know how to get, nor what to do with, an XML parser.
Respectfully,
Dave
LibreOffice 3.4.4 installed on XP
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

Drop me an email; I'd can take a look at the file privately, if you like.

If you can get an intact content.xml file out of the document, there's an even chance it can be repaired.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

The file was sent to me privately and I was able to fix the problem.

Since dahaoleboy asked for some details, and I've seen this same problem in two damaged Calc files recently, here's what I did. I'm working in Linux, so the precise steps will only work in that environment, but the overall strategy can be pursued on any system with similar tools.

0) Prep - make a copy of the damaged file, and a new directory to work in
  • $ cp damaged.ods damaged_copy.ods
    $ mkdir work
    $ cd work
1) Extract the content.xml portion of the document archive:
  • $ unzip ../damaged.ods content.xml
2) Run an xml syntax checker to see what errors are found
  • $ xmllint -noout content.xml
    content.xml:2: parser error : Attribute table:end-cell-address redefined
    :end-x="0.1409in" table:end-y="0.135in" draw:z-index="3" table:style-name="ce43"
    content.xml:2: parser error : Attribute table:end-x redefined
    :end-x="0.1409in" table:end-y="0.135in" draw:z-index="3" table:style-name="ce43"
    ...
So the problem is that some xml elements have attributes that are defined more than once within the same element. That's not valid xml, and OOo refuses to open the document.

We have to find which elements have the duplicate attributes and edit the xml so that only one set of attributes is present.

3) Open the content.xml file in a text editor (I use emacs, but any good editor should be fine)

The offending xml element looks like this (after some formatting):
  • <table:table-cell
      table:end-cell-address="&apos;Daily Expenses&apos;.U7"
      table:end-x="0.1413in" table:end-y="0.002in" draw:z-index="0"
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.1398in" draw:z-index="2"
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.135in" draw:z-index="3"
      table:style-name="ce43"
    />
You can see that there are actually three repeated definitions of the same attributes here.

I don't know exactly what these attributes do, and I don't know which definitions are the correct ones. The only strategy I have is to assume that the last set is the most recent and toss out the previous definitions. So, after removing the first two sets, the element looks like this:
  • <table:table-cell
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.135in" draw:z-index="3"
      table:style-name="ce43"
    />
Repeat the process for any other problems, and save the modified content.xml.

4) Replace the content.xml in the document copy with the updated (fixed) version:
$ zip ../damaged_copy.ods content.xml

Text the modified copy in OOo Calc--it works! Be happy. :D

This is clearly a bug in OOo--it's generated and saved invalid xml--but obviously it does not happen all the time, not even with the same file. I have no idea what triggers this particular error, but thankfully it's rather straightforward to fix.
AOO4/LO5 • Linux • Fedora 23
dahaoleboy
Posts: 3
Joined: Fri Dec 16, 2011 5:44 am

Re: [Hint] How did I fix my ODT file

Post by dahaoleboy »

THANK YOU, THANK YOU, THANK YOU, acknak. My file is now useable & I'm indebted to you for your assistance. Also, thanks for sharing how you fixed it as that provides us all with a little training to help make us better users.

One more question... In looking at the code you removed, i.e.,
table:end-cell-address="&apos;Daily Expenses&apos;.U7"
table:end-x="0.1413in" table:end-y="0.002in" draw:z-index="0"
table:end-cell-address="&apos;Daily Expenses&apos;.U6"
table:end-x="0.1409in" table:end-y="0.1398in" draw:z-index="2"
2 different cells are involved... U7 & U6. Shouldn't (or couldn't) U7 remain, or is there something else I'm not recognizing?

dahaoleboy

p.s.: I, too, use Linux... but only a little, so far. Someday, I'll become fully into using it... after finding compatible substitutes for Quicken, Turbo Tax, & Family Tree Maker... especially the inter-connection of the 1st two.
LibreOffice 3.4.4 installed on XP
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

dahaoleboy wrote:One more question... In looking at the code you removed, ... Shouldn't (or couldn't) U7 remain, or is there something else I'm not recognizing?
Honestly, your guess is as good as mine.

There must be only one value provided for the table:end-cell-address attribute, but which one is the right one, I can only guess.

Note that the spreadsheet cell that these properties apply to is 'Daily Expenses'.U5. I'm not sure what effect the end-cell-address setting has on the referenced cells. Maybe someone else knows, or wants to dig into the ODF spec and try to understand their purpose.
AOO4/LO5 • Linux • Fedora 23
TraceyC
Posts: 1
Joined: Tue Dec 27, 2011 4:31 am

Re: [Hint] How did I fix my ODT file

Post by TraceyC »

Many many thanks to acknak for detailing the steps to fix this problem. After reading through this thread, I was able to recover a Calc file that had been created in OO and opened in LibreOffice. It's been used / saved in LO for a few months, but I see the LO version still references OO.

In any case, the cell that I believe caused the problem contained a link to a formula in a cell in another spreadsheet. I noticed that when I opened the recovered spreadsheet, that cell had #REF. When I converted that to a number, all the rest of the formulas worked as expected. I just wanted to share this in case it helps the excellent OpenOffice developers find a fix for this annoying bug.
Tracey
LibreOffice 3.4.4
OOO340m1 (Build:402)
Lubuntu Linux
n6psu
Posts: 1
Joined: Sat Feb 25, 2012 10:31 pm
Location: Norway

Re: [Hint] How did I fix my ODT file

Post by n6psu »

Hi,

I have the same problem and I need some help as well as anyone. Because I speak very bad English, I can't understand in your above recommendations of the report. I would be very very grateful if someone could help me. I can send this fail to someone's email. Please help!
OpenOffice 3.3 on Windows Vista
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

I'll be happy to take a look at the broken document, but I can't promise any success at fixing it. Just email me (email button at right) and I'll send you an address you can send the document to.
AOO4/LO5 • Linux • Fedora 23
User avatar
floris v
Volunteer
Posts: 4422
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: [Hint] How did I fix my ODT file

Post by floris v »

Received a file by mail but it was damaged beyond what Zip Repair Tool 3.2 could recover. It only found a few graphics. None of my ordinary ZIP file programs could even open it.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
fire_qc
Posts: 2
Joined: Mon Feb 27, 2012 4:54 pm

Re: [Hint] How did I fix my ODT file

Post by fire_qc »

Please someone help me... I'm not very good in XML and after reading all the posts, this one seems very tough. My file contains all my working hours of 2012 and if I lost it, I'm going to bankrupt!!

Here a paste of what the xmllint tell me:

fire@linux-lar5:~/temp> xmllint --debugent content.xml
new input from file: content.xml
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^

Please help me somone....

FIRE........
LibreOffice 3.4 on OpenSuse 11.2 Evergreen
User avatar
floris v
Volunteer
Posts: 4422
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: [Hint] How did I fix my ODT file

Post by floris v »

Sent a PM.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

fire_qc wrote:...
Here a paste of what the xmllint tell me:
...
content.xml:2: parser error : Attribute table:end-cell-address redefined
...
This is exactly the same problem we discussed above: http://user.services.openoffice.org/en/ ... 49#p213749

The fix is exactly the same, although the xml is different. You have to remove the duplicate xml attributes so that there is only one unique value for the attribute.

You may have to guess as to which is the "right" value.
AOO4/LO5 • Linux • Fedora 23
fire_qc
Posts: 2
Joined: Mon Feb 27, 2012 4:54 pm

Re: [Hint] How did I fix my ODT file

Post by fire_qc »

I finally succeed to repair it, basing on what you said earlier!!!! But to help me, with emacs, I found the place with the problem. When opening LibreOffice, it gave me 2,324160(row,col) so I go to that position with emacs, remove repeated things, rezip, reopen with LibreOffice. The first time it tells me to fix ti, click yes and voilà!!!

Many thanks to everybody!! I'm still alive, Though I'm old, trite and weary (Still Alive - Nocturnal Rites)..

FIRE.........
LibreOffice 3.4 on OpenSuse 11.2 Evergreen
Turgon_Magno
Posts: 1
Joined: Thu Mar 22, 2012 2:12 pm

Re: [Hint] How did I fix my ODT file

Post by Turgon_Magno »

Hello, could you please help me with this file: http://www.mediafire.com/?jcxwa9bifjxw98k

I have the same problem: "Read-Error. Format error discovered in the file in sub-document content.xml at 2,263038 (row,col)."

Thank you!!!
LibreOffice 3.4 Linux / Windows Vista
User avatar
floris v
Volunteer
Posts: 4422
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: [Hint] How did I fix my ODT file

Post by floris v »

It seems that the archive is damaged. Zip repair Tool reduced the critical content.xml to a zero byte file, so that looks bad.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

Most of the content.xml is garbled, but I was able to recover a small amount of it.
Attachments
Inventari LPL_recovered.ods
(22.19 KiB) Downloaded 5344 times
AOO4/LO5 • Linux • Fedora 23
patriki
Posts: 2
Joined: Tue May 01, 2012 4:08 am

Re: [Hint] How did I fix my ODT file

Post by patriki »

2012_INVOICES.ods
(19.66 KiB) Downloaded 5510 times
Please somebody help me recover this file! I get the same Format Error. Tried uzipping it, are able to see the content.xml, but there are like over a dozen of "</office:automatic-styles>" tags - and whatever I tried, made the file useless... This is probably the most advanced computing I have ever had to deal with so far. :)
Can someone help?
Pasha
OpenOffice 3, Windows 7
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

All I could get back:
Attachments
2012_INVOICES_recovered.ods
(18.83 KiB) Downloaded 5202 times
AOO4/LO5 • Linux • Fedora 23
patriki
Posts: 2
Joined: Tue May 01, 2012 4:08 am

Re: [Hint] How did I fix my ODT file

Post by patriki »

Thanks for trying!!!!!
Gone baby gone..... :(
Pasha
OpenOffice 3, Windows 7
yeoford
Posts: 2
Joined: Sun Jul 15, 2012 1:22 am

Re: [Hint] How did I fix my ODT file

Post by yeoford »

Can anyone help with this .odt issue - novice

I was creating and saving an important open office document for my course when the system crashed. Could not get back into the file which was encoded with # all over the page.

First window popped up stating document in use 'July%202012%20couns%20essay%20prof%20issues.odt' locked for editing Unknown user.

I opened as read only and saved a copy all text showing as #. I have also saved a copy of the original now corrupted file in another folder and it opens straight into the doucument but still only shows # text all over every page.

husband has spent hours trying to sort but cannot

can anyone fix this please or is it bust.
July 2012 couns essay prof issues.odt
(24.37 KiB) Downloaded 5677 times
Open Office 3.3 on Windows Vista
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

So sorry, nothing there to recover: the file contains nothing but zeros.
AOO4/LO5 • Linux • Fedora 23
yeoford
Posts: 2
Joined: Sun Jul 15, 2012 1:22 am

Re: [Hint] How did I fix my ODT file

Post by yeoford »

Thanks for taking a look. Back to starting another days work. I'll backup this time. :(
Open Office 3.3 on Windows Vista
nuukee
Posts: 1
Joined: Mon Jul 23, 2012 4:17 pm

Re: [Hint] How did I fix my ODT file

Post by nuukee »

Similar problem here.

Have a file created in OO. Saved that with LO a while back and got the "Format Error".

The problem was the same as above. One attribute was used 4 times. So removed three occurences and everything worked.
Now a few weeks later, countless edits later the same problem occured. Format error, four occurences of one attribute in one tag. Removed them, xml looks ok. Can open it with xml editors without any problems, also xmllint does not complain anymore.
However, I still cannot open the file. No I receive:

1. "The file is corrupted blabla click yes to repair"
2. "The file '$(ARG1)' could not be repaired and therefore cannot be opened" ... I click ok and LO terminates with "General Error"

I tried many things, including the complete removal of the tag, playing around with neighboring tags etc. always with the same result.
Any further suggestions? Thank you very much!
LibreOffice 3.4.4 on Ubuntu 11.10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Hint] How did I fix my ODT file

Post by acknak »

Maybe someone else has an idea, but it's hard to say much of anything without having the file to examine. You can attach it here, or upload it somewhere else and leave a link here.
AOO4/LO5 • Linux • Fedora 23
Post Reply