[Solved] LibreOffice docx corrupted

Help with installation and general system troubleshooting questions concerning the office suite LibreOffice.
Post Reply
leeko
Posts: 5
Joined: Tue May 16, 2017 7:49 pm

[Solved] LibreOffice docx corrupted

Post by leeko »

Hi everyone,

I'm using libreoffice writer 5.1.6.2 on ubuntu 16.04LTS. I saved an important document in .docx format (required by publisher), and when I tried to reopen it, it is corrupted. The error message is:

Code: Select all

File format error found at 
SAXParseException: "No namespace defined for pic"
SAXParseException: '[word/document.xml line 2]: Namespace prefix pic on bodyPr is not defined
', Stream 'word/document.xml', Line 2, Column 151229(row,col).
I've tried extracting the xml file, and opening the word/document.xml in gedit. But, I can't figure out how to edit the existing rows. I'm able to add new rows, but gedit won't let me navigate within the row. Also, is there any way to specify which position within a line you want to go to? Pressing the right arrow until the cursor gets to position 151229 is incredibly inefficient!

I tried to attach the document.xml file, but the forum software limits attachments to 128kb. Instead, it is linked here: https://drive.google.com/open?id=0BwnSy ... y0wMHRzR0U

Checking the xml with

Code: Select all

xmllint -noout word/document.xml
Gives the following output:

Code: Select all

xmllint -noout Desktop/Tissue\ Expansion\ Chapter\ -\ revised\ 5-9-17\ FINAL\ \(copy\)/word/document.xml 
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on wsp is not defined
phicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:wsp
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on cNvSpPr is not defined
hemas.openxmlformats.org/drawingml/2006/picture"><pic:wsp><pic:cNvSpPr txBox="1"
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on spPr is not defined
mlformats.org/drawingml/2006/picture"><pic:wsp><pic:cNvSpPr txBox="1"/><pic:spPr
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on txbx is not defined
ill><a:srgbClr val="000000"/></a:solidFill><a:miter/></a:ln></pic:spPr><pic:txbx
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on bodyPr is not defined
ntent></pic:txbx><pic:bodyPr lIns="90000" rIns="90000" tIns="45000" bIns="45000"
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on wsp is not defined
phicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:wsp
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on cNvSpPr is not defined
hemas.openxmlformats.org/drawingml/2006/picture"><pic:wsp><pic:cNvSpPr txBox="1"
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on spPr is not defined
mlformats.org/drawingml/2006/picture"><pic:wsp><pic:cNvSpPr txBox="1"/><pic:spPr
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on txbx is not defined
ill><a:srgbClr val="000000"/></a:solidFill><a:miter/></a:ln></pic:spPr><pic:txbx
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: namespace error : Namespace prefix pic on bodyPr is not defined
ntent></pic:txbx><pic:bodyPr lIns="90000" rIns="90000" tIns="45000" bIns="45000"
                                                                               ^
Desktop/Tissue Expansion Chapter - revised 5-9-17 FINAL (copy)/word/document.xml:2: parser error : Extra content at the end of the document
inePitch="240" w:charSpace="4294965247"/></w:sectPr></w:body></w:document>  
It looks like there are multiple errors within the file. Unfortunately, I don't know how to fix these. If anyone could please help me get this document recovered, I'd very much appreciate it!

Thanks in advance for any help you can provide!

Lee
Last edited by Hagar Delest on Tue May 16, 2017 10:09 pm, edited 1 time in total.
Reason: tagged [Solved].
Libreoffice 5.1.6.2 on Ubuntu 16.04LTS
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Libreoffice docx corrupted

Post by Zizi64 »

I saved an important document in .docx format (required by publisher),
Always store your important documents into the native, International Standard ODF fileformat. And at end of the editing you can make a copy in a foreign format.
Do you have a backup copy of your document?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Libreoffice docx corrupted

Post by FJCC »

Please post the entire docx file, not just the document.xml file. That makes it easier to check that the document is really repaired.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Libreoffice docx corrupted

Post by RoryOF »

Paste the XML file you uploaded into an XML editor (I use XML Copy Editor). Then use /XML /Check Well formedness. Make any corrections at the location it pinpoints. Then Save the file and reinsert into the .docx.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Libreoffice docx corrupted

Post by Villeroy »

You should have the original odt file because you should always work in the native file formats of your application (od? with LiberOffice, docx with Word, psb with Photoshop) and export a copy to whatever possible format when you are going to distribute your work.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Libreoffice docx corrupted

Post by acknak »

The docx files I have include lines such as these:
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006
/main">
     ...
      <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/
2006/picture">
         <pic:nvPicPr>
Which configure the namespaces a and pic. It seems those are missing or not defined properly in your file.

As others have already pointed out, it's best not to rely on foreign formats to store your work. You can always export to a foreign format as needed, but keep your active work in ODF.
AOO4/LO5 • Linux • Fedora 23
leeko
Posts: 5
Joined: Tue May 16, 2017 7:49 pm

Re: Libreoffice docx corrupted

Post by leeko »

Hi everyone,

Thank you for the advice. Obviously, I understand now that relying on libreoffice's docx functionality is not a good idea. I have an odt file saved, but it is a previous version with hours of work in between. Lesson learned.

I added the pic reference as suggested, which got rid of that error message, but now I get the following error instead:

Code: Select all

File format error found at 
SAXParseException: '[word/document.xml line 2]: Extra content at the end of the document
', Stream 'word/document.xml', Line 2, Column 213809(row,col).
I don't know what's "correct" and what is "extra" within the xml file. Going to column 213809 doesn't really make things clearer, as it's in the middle of "correct-appearing" code.

I've uploaded my complete docx file here: https://drive.google.com/open?id=0BwnSy ... VoTVg5M1FF

Again, thanks for any help you can offer.

Best regards,

Lee
Libreoffice 5.1.6.2 on Ubuntu 16.04LTS
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Libreoffice docx corrupted

Post by RoryOF »

The file as uploaded is opening correctly(?) for me in OpenOffice 4.1.3. I have resaved it; if you send me a PM wiih an email address I'll send it to you.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
leeko
Posts: 5
Joined: Tue May 16, 2017 7:49 pm

Re: Libreoffice docx corrupted

Post by leeko »

Hi Rory,

Thanks for sending me the repaired file. Unfortunately, it still gives me an error message. This time, I get:

Code: Select all

File format error found at 
SAXParseException: "No namespace defined for pic"
SAXParseException: '[word/document.xml line 2]: Namespace prefix pic on bodyPr is not defined
', Stream 'word/document.xml', Line 2, Column 151229(row,col).
Would you mind saving the opened document in odt format?

Thanks again!

Lee
Libreoffice 5.1.6.2 on Ubuntu 16.04LTS
leeko
Posts: 5
Joined: Tue May 16, 2017 7:49 pm

Re: Libreoffice docx corrupted

Post by leeko »

Rory, odt format did the trick. Thanks very much!

The formatting needs a little work (mostly just the bullets icons are missing), and the figures are cut off at the end of the document, but I have those in a separate file. Easy to fix!

Thanks again - you just saved me a lot of work!

Lee
Libreoffice 5.1.6.2 on Ubuntu 16.04LTS
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Libreoffice docx corrupted

Post by RoryOF »

I have sent the .odt version by email. I suspect, from the size, that it has no figure inserted in it. The .docx,as posted, opened correctly in OO 4.1.3.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
leeko
Posts: 5
Joined: Tue May 16, 2017 7:49 pm

Re: Libreoffice docx corrupted

Post by leeko »

Thanks Rory :)
Libreoffice 5.1.6.2 on Ubuntu 16.04LTS
User avatar
henke54
Posts: 382
Joined: Thu Apr 02, 2009 6:10 pm
Location: Flanders Belgium

Re: Libreoffice docx corrupted

Post by henke54 »

Villeroy wrote:.....psb with Photoshop).....
Photoshop is (expensive) proprietary software, better use GIMP

https://www.gimp.org/ ;)
Photoshop is a professional-grade tool that comes with a professional-grade price. While earlier editions of Photoshop cost hundreds of dollars, Adobe now distributes it through its Creative Cloud platform for a monthly fee.

Photoshop also supports a number of third-party add-ons. While some are free to install, others are commercial software. These add-ons extend Photoshop’s capabilities in a number of ways, adding specific filters, bundles of actions to achieve a particular effect, or templates for different use cases. Many of these add-ons can now be accessed and downloaded through Adobe Creative Cloud itself.

An open-source program, GIMP is free to install and use. It’s also supported by a vibrant open-source community. However, as with other open-source software, finding the best plugins can be a bit of a challenge. The GIMP plugin registry contains several hundred plugins that add everything from new filters to brushes to additional save and export options.
What Are You Using It For?

When you select an image editing program, it really comes down to what features you need most. If you’re a professional designer, photographer, or if you’re creating for print, then Photoshop will have the tools you need to do just about anything. Hobbyists and occasional designers, however, may be pleasantly surprised to find that GIMP covers the majority of their image editing needs.
LibreOffice 6.0.7.3
on Linux Mint Mate
Post Reply