4teamwork/docxcompose

SmartArt results in corrupt document.

Closed this issue · 1 comments

Create a composed file based on

master: header.docx
appended doc: smartart.docx

this will result in a document which is considered corrupt by word. the document can be recovered by word, but the smart-art item is missing from the result: corrupt.docx

a-w commented

Working with header.docx being a document converted from .doc format and having a shape in the header. Then after appending a document containing any pixmaps, when opening the combined document, Word says (under details):

Unknown error
Location: Part: /word/header1.xml, Line 2, Column:0

The document can be recovered. Unlike the smartart example above, all pixmaps are present.

I compared header1.xml before and after Word recovered the content. It turned out that the only change Word made was to replace the id in a <wp:docPr id="1" ... /> in header1.xml. Looks like these ids need to be unique across the document and combining several documents fails to take all sources of those ids into account.

Interestingly, removing the existing shape and replacing it with a new one solved the problem. However, the observation with the id could be valuable for the other cases too.