Bug 57579

Summary: FILESAVE docx Exporter Generates Invalid XML in header1.xml and document.xml Files
Product: LibreOffice Reporter: P. Scott DeVos <pscottdv>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: major CC: jorendc
Priority: medium    
Version: 3.5.7.2 release   
Hardware: x86 (IA32)   
OS: All   
Whiteboard: (target:4.3.0)
Crash report or crash signature: Regression By:
Attachments: document that displays the problem

Description P. Scott DeVos 2012-11-26 23:26:52 UTC
Created attachment 70629 [details]
document that displays the problem

When saving a file to docx (Word 2007/2010) format, LibreOffice Writer generates invalid XML.  Specifically, there were numerous </w:tc> closing tags with no matching opening tag in both header1.xml and documenet.xml.  header1.xml also contained </w:tr> and </w:tbl> closing tags with no matching opening tag.

I attempted to add the opening tags manually where they seemed to belong, but Word 2010 reported the resulting zipped docx file to be corrupt.

BTW, LibreOffice, itself WILL open the docx file that it creates, but only shows the first page.

LibreOffice will also open the manually repaired .docx file and will show all three pages, but the header on the 2nd and third page is missing and one of the split cells of the table is handled incorrectly.

The document in question is attached in odt format.
Comment 1 billhook 2012-11-27 10:29:05 UTC
Confirmed on LO 3.6.4.1 Windows XP 32bit.

To reproduce:

1. Open the attached .odt file
2. Save as .docx format.
3. Try to open the .docx in Microsoft Office (I tried using Office 2007)

Observed behaviour:

An error message appears in Office:

"The file senior_programmer.docx cannot be opened because there are problems with the contents.

The name in the end tag of the element must match the element type in the start tag.

Location: Part: /word/header1.xml, Line:2, Column:764"
Comment 2 billhook 2012-11-27 10:40:55 UTC
Possibly a duplicate of Bug 55820 FILESAVE: silently corrupts docx file
Comment 3 Jorendc 2014-02-14 15:04:58 UTC
Reproducible tested using Mac OSX 10.9 with LibreOffice Version: 4.1.5.3 
Build ID: 1c1366bba2ba2b554cd2ca4d87c06da81c05d24

NOT reproducible tested using LibreOffice Version: 4.3.0.0.alpha0+
Build ID: a315454f349469923490e4116806ee19263849b8

I opened the saved .docx using Word for Mac 2011.

Conclusion: fixed in upcoming 4.3 version. Not sure about current 4.2 version.
Marking this bug as RESOLVED WORKSFORME (we don't know which patch resolved this issue)

Kind regards,
Joren