Error 'We can't open [file name].docx because we found a problem with its contents.' and 'Unexpected end of input' while opening target docx created in WorldServer

Symptoms/context:

When trying to open a generated target translation (*.docx) document in Microsoft Word is displaying the following message: 

We're sorry. We can't open [file name].docx because we found a problem with its contents.

After clicking on the Details button, the actual error

Unexpected end of input

appears, pointing to the document.xml

Error message in Microsoft Word stating 'We're sorry. We can't open file name.docx because we found a problem with its contents.' with a Details button showing 'Unexpected end of input' at document.xml location.

 

Root Cause:

This issue points to a corruption of the target DOCX file. The document.xml is truncated and missing the closing tags. This is a filter issue, fixed in later versions of WorldServer and of the Microsoft Word 2007-2016 File Type.
 
Resolution:
This issue is fixed in later versions of WorldServer with the updated version of the Microsoft Word 2007-2016 File Type. If possible, upgrade to a later version. The workaround in WorldServer 10.4.4. is as follows:
 
  • Download the source DOCX file from WorldServer along with the target DOCX file that cannot be opened.
  • Open the source DOCX file with Winzip or Winrar
  • You will see the actual file and folder structure of the DOCX file.

Winzip file explorer showing the folder structure of a DOCX file with folders '_rels', 'docProps', and 'word', highlighting the 'document.xml' file within the 'word' folder.

 

  • In the word folder, find the document.xml file and open it in an XML Editor, for instance Notepad ++ or firstobject XML Editor
  • Open both document.xml: the one belonging to the source DOCX and the one belonging to the target DOCX.
  • Run a file validation of the target document.xml and you will get an error related to missing closing tags. For instance: 
            The following tags were not closed: w:document, w:body, w:tbl, w:tr, w:tc
  • Compare the 2 document.xml files and find the location where the target (corrupted) document.xml finished and find that same location in the source document.xml.
  • Copy the missing content from the source document.xml to the target document.xml and run another file vaidation. There should be no more errors
  • Now save your changes in the target document.xml and try again to open the target DOX file. It should work
  • Provide the repaired DOCX file to the customer and replace the corrupted one with the fixed file in the target folder in Explorer.


Generated Image Alt-Text
[edited by: Trados AI at 3:43 AM (GMT 0) on 5 Mar 2024]
emoji