Makarand
I am sorry, but I think your file is damaged beyond repair. I have corrected what must amount to hundreds of errors in the XML coding (I don't know exactly because I use Find / Replace all when I could). What concerns me is the following
1 I don't understand XML so I don't know what I am doing. I am going to the error, and looking for similar expression in the file, and changing the error to look like what else I have found. This may work, but I may be changing the data or formulae in your spreadsheet without realising.
Edit: It is easier to see what the XML is doing if you format the XML with a so called "Pretty Printer" which "aligns the tags" and breaks the XML into separate, indented lines. There are utilities available (fee and free) or you can use a website such as http://xmlprettyprint.com/ which allows you to paste the XML, and it formats it neatly. Copy it back into an editor like Notepad etc to view it easily. |
2 I am only searching for XML format errors. What happens if there is corruption in a cell value which changes the number or formula but does not cause an XML error? Your spreadsheet would be wrong, but I would not spot it.
If you want to continue, here is how I am doing it. But
I would not trust the file even if you manage to fix it.
1 Extract content.xml out of Revenue...ods. (You can double click on it and it opens in Internet Explorer which displays it in "readable fashion" now I have corrected a lot of errors. You might be able to extract cell values out of this view. Note how the view of the damaged content.xml file is different from doing the same with content.xml from the working backup file)
2 Try to open content.xml with an XML editor. I used the freebie XML Notepad. It gives an error message "Error loading ... Line 2, position 797991 ..." saying it does not understand the XML at Column 797991 in line 2. This is the same error number (+ / - 1) you get if you put content.xml back into the odt file and open it with AOO - it's quicker using XML Notepad each change!).
3 Open content.xml with an editor like Notepad++ which has position information. The broken file consists of just two lines, the first with 39 characters, the second with 1,128,432 characters. All the errors seem to be after 793,000 so there are about 500,000 characters to check!
Position the cursor at the start of line 2. Choose Offset. Type in 797991 and go to it. Check with the counter at the bottom you are actually there - arrow left / right to get to 797991. When the counter shows 797991 you are at the error. You now see table:formula="of:5000"5" and you have to work out what is wrong with it and how to correct it.
4 When you have corrected it, save.
5 Now go to step 2. Repeat until no more errors.
6 Put content.xml back into the odt file and see if it opens in AOO.
In the file you sent I got the following typical errors: (Note I have copied the whole phrases between < ... >)
<office:forms form:automatic-focus="false"000"><tdly-design-modes="false"/>
which I thought should be
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
at 793604
<table:table-column table:style-name="co7" table:number-columns-repeated=28" table:default-cell-style-name="Default"/>
Which I thought should be ( "28", not 28" )
<table:table-column table:style-name="co7" table:number-columns-repeated="28" table:default-cell-style-name="Default"/>
At 793921
<table:table-row table:style-name="ro1" table:number-rows-repeated=51">
which I thought should be ( "51" not 51" )
At 794395
<table:table-cell table:formula="of:(38000000*0.01)-4000]" office:value-type="float" office:value=""30000">
which I thought should be ( "30000, not ""30000)
<table:table-cell table:formula="of:(38000000*0.01)-4000]" office:value-type="float" office:value="30000">
At 794408
<text:p""30000</text:p>
which I thought should be
<text:p><30000</text:p>
I also corrected errors at 794672, 794927 and 796259.
Why has this happened? No-one seems to know. What we need is a good file just before this happens, the bad file which won't open, and a good description of exactly what you did to save and open it. The developers should then have something to test. But the file isn't corrupted in the normal sense of random corruption - it seems quite systematic and does the same corruption in multiple places in the file, so it does repeat so it should be able to be debugged. I guess it could be when AOO writes to the content.XML file; it could be when AOO compresses (ZIPs) the content.XML file; or it could be when AOO decompresses the content.XML file.