OpenOffice Writer issue - Read-Error - Format error

Issues with installing under all versions of MS Windows

OpenOffice Writer issue - Read-Error - Format error

Postby planktondear » Wed May 13, 2020 10:32 pm

Hello!

I'm having some serious trouble with OpenOffice and I'm hoping someone can help.

I've been working on an assignment and I need to hand this back tomorrow - I was using OpenOffice Writer and tracking changes. I saved the document after completing it and closed it. I can no longer open the document.

I get the error: Read-Error. Format error discovered in the file in sub-document styles.xml at 2, 15053(row, col).

I have tried the following tutorial and everything else I could find via google:

https://forum.openoffice.org/en/forum/viewtopic.php?f=71&t=87180#p408523

I got as far as extracting the .odt file and trying to amend the styles.xml file, I did this and then re-zipped the folder, then renamed the file type to .odt, but upon opening I just get a single page with a line of gibberish.

Can someone please help me? You would have my undying gratitude! I'm unable to attach the file (too large) but can email this to anyone that can help.

Thank you so much in advance!
OpenOffice 4.1.7, Windows 10
planktondear
 
Posts: 3
Joined: Wed May 13, 2020 10:23 pm

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Wed May 13, 2020 11:56 pm

I have sent you an email with my email ID.

It's a bug in AOO but not in LO. See Issue 128356 - Track Changes and Annotations on text range can cause corruption. Applies to 4.x (all versions?) where deleting two (or more?) comments attached to a range of characters while track changes is switched on causes it.

The repair is simple.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby robleyd » Thu May 14, 2020 1:42 am

Alternatively, you could put the file on a file sharing site and put a link here.
Cheers
David
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice 6.4.6.2 (SlackBuild for 6.4.6 by Eric Hameleers) - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 3644
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: OpenOffice Writer issue - Read-Error - Format error

Postby planktondear » Thu May 14, 2020 8:30 am

John_Ha wrote:I have sent you an email with my email ID.

It's a bug in AOO but not in LO. See Issue 128356 - Track Changes and Annotations on text range can cause corruption. Applies to 4.x (all versions?) where deleting two (or more?) comments attached to a range of characters while track changes is switched on causes it.

The repair is simple.


Hi John_Ha, thanks for your help - I've emailed the file over to you. Anything you can do would be fantastic as I've put about 20 hours of work into editing this document and somehow managed to forget to save any backups! I've downloaded LO as well for future use, thanks for the tip.

robleyd wrote:Alternatively, you could put the file on a file sharing site and put a link here.


Hi robleyd, thanks for your reply - John_Ha is taking a look just now and I'm hoping will be able to point me towards a fix, but if not I'll post a link to the file here - since it isn't originally my material I don't want to share it too widely if possible, just out of respect for the original author :)
OpenOffice 4.1.7, Windows 10
planktondear
 
Posts: 3
Joined: Wed May 13, 2020 10:23 pm

Re: OpenOffice Writer issue - Read-Error - Format error

Postby RoryOF » Thu May 14, 2020 9:09 am

@John_Ha: such an error in styles.xml? Have we seen such before, John?
Apache OpenOffice 4.1.8 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31994
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Thu May 14, 2020 12:22 pm

I fixed the file. The corruption was in styles.xml - the first I have seen. I have updated the bug report to say

I have just repaired a user's file where styles.xml was corrupted with two office:name annotations. The corruption was similarly in the first style definition in the file.

The file was full of comments and I could replicate the problem by deleting a range of text which included two comments each attached to a range of text while Track changed was ON.

If I switched off Track changes I could delete all the comments (in a comment > arrow down > Delete all comments) without problems.

I have advised the poster to do that or switch to LO.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby planktondear » Thu May 14, 2020 1:29 pm

That's it sorted now, can open it without any issues and all the edits/comments are still there - thank you so much John_Ha!

I'm going to use LO for editing in the future.
OpenOffice 4.1.7, Windows 10
planktondear
 
Posts: 3
Joined: Wed May 13, 2020 10:23 pm

Re: OpenOffice Writer issue - Read-Error - Format error

Postby RoryOF » Thu May 14, 2020 1:31 pm

Whichever program you use, turn off Track Changes; it seems to cause many problems.
Apache OpenOffice 4.1.8 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31994
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Thu May 14, 2020 2:38 pm

RoryOF wrote:Whichever program you use, turn off Track Changes; it seems to cause many problems.

I cannot see using tracked changes being a problem with LO as LO has fixed the bug.

Whereas the problem is easily replicated in AOO I cannot cause it in LO no matter what I do.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby Hagar Delest » Thu May 14, 2020 4:21 pm

Maybe that tool would have helped: [Tutorial] ODF repair tool.
The tutorial is not finished yet but there should be enough to test it on a actual damaged file.
LibreOffice 7.0.3 on Xubuntu 20.10 and LibreOffice 6.4.6 (portable) on Windows 10.
User avatar
Hagar Delest
Moderator
 
Posts: 29258
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Thu May 14, 2020 6:00 pm

Hagar

The tool did repair the file though with a slight problem which meant it did not work but should be trivial to fix. I think he probably replaces the broken styles.xml into the .odt file instead of the repaired one.

It seems that the tool looks through all the XML files. The dialogue I got was as follows where I translated it with Google Translate.

Repairing an ODF file
Use the File-> Open (Fichier > Ouvrir) menu to select an ODF file to process.
Zip and Microsoft docx, xlsx or pptx files can also be processed by this software.

Choose the "File -> Analyze" menu to start scanning the archive file.

Once the analysis is complete, you can choose the menu "File -> Extract" to start the extraction of recoverable elements, then choose the "File -> Repair" menu to repair corrupt XML sub documents and restore a repaired archive file.

The repaired file will be in the same folder and named Broken_file_repare.odt.

Broken_file.odt:

***
Analysis:

Entry number 1:
Name = mimetype
File size 0.038 kB, compressed size 0.038 kB
File probably recoverable!

Entry number 2:
Name = Configurations2 / floater /
File Path.

Entry number 3:
Name = Configurations2 / accelerator / current.xml
File size 0.0 kB, compressed size 0.002 kB
Unrecoverable file!

Entry number 4:
Name = Configurations2 / images / Bitmaps /
File Path.

Entry number 5:
Name = Configurations2 / menubar /
File Path.

Entry number 6:
Name = Configurations2 / progressbar /
File Path.

Entry number 7:
Name = Configurations2 / popupmenu /
File Path.

Entry number 8:
Name = Configurations2 / toolbar /
File Path.

Entry number 9:
Name = Configurations2 / statusbar /
File Path.

Entry number 10:
Name = Configurations2 / toolpanel /
File Path.

Entry number 11:
Name = Thumbnails / thumbnail.png
File size 2.361 kB, compressed size 2.361 kB
File probably recoverable!

Entry number 12:
Name = content.xml
File size 1,014,252 kB, compressed size 174,004 kB
File probably recoverable!

Entry number 13:
Name = layout-cache
File size 2.485 kB, compressed size 0.765 kB
File probably recoverable!

Entry number 14:
Name = settings.xml
File size 9.282 kB, compressed size 1.398 kB
File probably recoverable!

Entry number 15:
Name = styles.xml
File size 35.929 kB, compressed size 4.303 kB
File probably recoverable!

Entry number 16:
Name = manifest.rdf
File size 0.878 kB, compressed size 0.255 kB
File probably recoverable!

Entry number 17:
Name = meta.xml
File size 1.005 kB, compressed size 1.005 kB
File probably recoverable!

Entry number 18:
Name = META-INF / manifest.xml
File size 1.157 kB, compressed size 0.298 kB
File probably recoverable!

Analysis completed!

Choose the menu "File -> Extract" to start the extraction of recoverable elements. You can also open another file or exit.

Broken_file.odt file:
***
Extraction of compressed elements:

Entry number 1:
Name = mimetype
END OF BLOCK READING!
Number of blocks read = 1
Recovered file.

Entry number 2:
Name = Configurations2 / floater /
Folder path.

Entry number 3:
Name = Configurations2 / accelerator / current.xml
END OF BLOCK READING!
Number of blocks read = 0
Unrecoverable file!

Entry number 4:
Name = Configurations2 / images / Bitmaps /
Folder path.

Entry number 5:
Name = Configurations2 / menubar /
Folder path.

Entry number 6:
Name = Configurations2 / progressbar /
Folder path.

Entry number 7:
Name = Configurations2 / popupmenu /
Folder path.

Entry number 8:
Name = Configurations2 / toolbar /
Folder path.

Entry number 9:
Name = Configurations2 / statusbar /
Folder path.

Entry number 10:
Name = Configurations2 / toolpanel /
Folder path.

Entry number 11:
Name = Thumbnails / thumbnail.png
END OF BLOCK READING!
Number of blocks read = 3
Recovered file.

Entry number 12:
Name = content.xml
END OF BLOCK READING!
Number of blocks read = 1025
Recovered file.

Entry number 13:
Name = layout-cache
END OF BLOCK READING!
Number of blocks read = 3
Recovered file.

Entry number 14:
Name = settings.xml
END OF BLOCK READING!
Number of blocks read = 10
Recovered file.

Entry number 15:
Name = styles.xml
END OF BLOCK READING!
Number of blocks read = 36
Recovered file.

Entry number 16:
Name = manifest.rdf
END OF BLOCK READING!
Number of blocks read = 1
Recovered file.

Entry number 17:
Name = meta.xml
END OF BLOCK READING!
Number of blocks read = 2
Recovered file.

Entry number 18:
Name = META-INF / manifest.xml
END OF BLOCK READING!
Number of blocks read = 2
Recovered file.

The elements which could be extracted are in the file:
C: \ Users \ John \ Desktop \ Fred

Extraction folder: C: \ Users \ John \ Desktop \ Fred

Choose the "File -> Repair" menu to reconstruct the archive from the extracted elements after repairing corrupt XML files. You can also open another file or exit.

Broken_file.odt file:

Reconstruction of the archive in zip format:
---------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ content.xml

Xml file => Analysis and repair:

- File C: \ Users \ John \ Desktop \ Fred \ content.xml intact.
---------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ layout-cache
---------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ manifest.rdf
---------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ META-INF \ manifest.xml

Xml file => Analysis and repair:

- File C: \ Users \ John \ Desktop \ Fred \ META-INF \ manifest.xml intact.
-------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ meta.xml

Xml file => Analysis and repair:

- File C: \ Users \ John \ Desktop \ Fred \ meta.xml intact.
----------------------------------------------------------
Add file C: \ Users \ John \ Desktop \ Fred \ mimetype
-------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ settings.xml

Xml file => Analysis and repair:

- File C: \ Users \ John \ Desktop \ Fred \ settings.xml intact.
-------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ styles.xml

Xml file => Analysis and repair:

- Corrupt styles.xml file!
- Attempt to repair:

Position 15212:

"Office: name" attribute:
-> excess definition deleted.

******
Summary of the analysis:

- Number of characters read = 36777
- Tag attributes:
-> Multiple definitions removed: 1
******
- File repaired: styles_repare.xml
- Included in the zip file with the name styles.xml.
---------------------------------------------------------- -
Add file C: \ Users \ John \ Desktop \ Fred \ Thumbnails \ thumbnail.png

Reconstruction of the archive completed.

Repaired file: Broken_file_repare.odt Folder where the repaired file is located:
C: \ Users \ John \ Desktop

Open another file or exit.

I then found I had a file called Broken_file_repare.odt on my desktop. I double clicked Broken_file_repare.odt and got this error message:

Clipboard03.png
Clipboard03.png (9.75 KiB) Viewed 952 times


I allowed AOO to repair the file and it opened and as far as I could see was OK. I then saved the file and AOO would not open it giving this error.
Clipboard01.png
Clipboard01.png (5.59 KiB) Viewed 954 times

The repeated definition was still there albeit at a slightly different location, 15,335 compared with 15,053 before.

Code: Select all   Expand viewCollapse view
<style:style office:name="__Annotation__11157_1835157684" office:name="__Annotation__11159_1835157684" style:name="MP1" style:family="paragraph" style:parent-style-name="Header">
   <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0mm" fo:margin-bottom="3.53mm" fo:text-align="end" style:justify-single-word="false"/>
   <style:text-properties style:font-name="Times New Roman" fo:font-size="9pt" style:font-size-asian="9pt" style:font-name-complex="Times New Roman" style:font-size-complex="9pt"/>
</style:style>

I also had the folder Fred on my desktop and it contained all the unzipped files, where styles.xml was presumably the original broken file and styles_repare.xml was the repaired one.

Clipboard05.png

I deleted styles.xml, renamed styles_repare.xml to styles.xml and zipped it back to My_repair.odt which opened without any error message and could be saved so was fully repaired.

I did not debug this further but it should be pretty simple - I will look again when I have more time.

I have sent you Broken_file.odt for you to test.

It should be trivial to change the Write commands in the Java utility to English.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Thu May 14, 2020 7:04 pm

I see the problem.

He only deletes one of the office:name="__Annotation__11157_1835157684" - he should delete both.

Code: Select all   Expand viewCollapse view
<style:style office:name="__Annotation__11157_1835157684" style:name="MP1" style:family="paragraph" style:parent-style-name="Header">
   <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0.353cm" fo:text-align="end" style:justify-single-word="false"/>
   <style:text-properties style:font-name="Times New Roman" fo:font-size="9pt" style:font-size-asian="9pt" style:font-name-complex="Times New Roman" style:font-size-complex="9pt"/>
</style:style>

Normally, these errors arise because something like w:themeShade, w:themeColor or w:cstheme gets duplicated, and you need to delete the duplicate, leaving one behind.

However, office:name gets put multiple times (I have seen 5 or 6) into the first style definition and all occurrences need to be deleted.

See Re: [Tutorial] Format error discovered in sub-document which says

It appears that there are (at present) two different problems which require slightly different solutions.

Case 1: Multiple added "office:name="__Annotation__714_93247550611111"" ... the fix is to delete all occurrences of them so as to restore the style definition

Case 2: Repeated attributes such as w:themeShade, w:themeColor and w:cstheme ... The fix is to find the repeats, and delete only the repeats so as to leave just one occurrence ...
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Thu May 14, 2020 9:07 pm

Two more things

1. If you delete just one of the office annotations then the file opens fine. However, make a trivial edit and save it. When you open it you get the same error pointing at the office annotation left.

I have a vague recollection of having been told that AOO's error checking while writing a file is not as effective as the error checking when reading a file. That would explain this.

2. I think styles.xml is affected, rather than content.xml, because the reviewer changed some styles and those recorded changes are placed in styles.xml. Recorded changes in the text are placed in content.xml.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: OpenOffice Writer issue - Read-Error - Format error

Postby Hagar Delest » Thu May 14, 2020 11:43 pm

Thanks for the investigation John!
Some tweaks needed on the tool then.
LibreOffice 7.0.3 on Xubuntu 20.10 and LibreOffice 6.4.6 (portable) on Windows 10.
User avatar
Hagar Delest
Moderator
 
Posts: 29258
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: OpenOffice Writer issue - Read-Error - Format error

Postby John_Ha » Fri May 15, 2020 1:59 am

Hagar

I am now more confused than I was at the start so don't take anything above as absolutely correct.

I now believe that the file becomes corrupted by some mechanism we have not yet discovered but when recorded changes is set.

When AOO operates on a corrupted file we get all sorts of problems.

If there is an office annotation needed in the style definition because of a recorded change in the file AND I delete that annotation, AOO promptly puts it back! So, a .odt file is quite happy having one instance of office annotation in the style definition. But it does not like two instances.

But, if there is not a recorded change in the file which needs an annotation (or the annotation has a different ID), and a single instance occurs in the style definition, then that is not OK and the file gives the error.

When manually fixing files deleting both annotations always fixes it because if one is needed, AOO puts it back. Hence I think it sensible for the utility to delete both instances to guarantee any "not needed" annotation is deleted.

I have managed to cut the file down to two empty pages and just a few words and I can still force the error so development will not have to wade through a huge file. The cut down file has content in styles.xml (recorded changes) which do not show when I edit the .odt file and attempt to Accept/Reject changes so I think this is the corruption at the root of the problems. Let me have your email and I will send you the files.

A developer who understands how the code works should be able to work out what is happening very quickly.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 8067
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK


Return to MS Windows

Who is online

Users browsing this forum: No registered users and 9 guests