This project has moved and is read-only. For the latest updates, please go here.

Corrupt document after InsertDocument



I have two (related?) issues, I am trying to use InsertDocument to merge a document into a document I am creating.

However, my first issue is that I lose styling on the inserted document, and also styles appear to "bleed" into the other document.

In particular, bullet points are lost. If I run the following code with the attached test.docx then the result is the attached testOut.docx. These documents are clearly different, but they shouldn't really be that different.:
using (var stream = new MemoryStream())
    var newdoc = Novacode.DocX.Create(stream);
    var doc = Novacode.DocX.Load(@"c:\test.docx");
I am also trying to insert a document into another (I can't provide these for data sensitivity reasons), and with those documents I actually get an error when trying to load the documents in Word, and opening Word/document.xml it appears that the xml tags no longer even match up.

file attachments


RichardCocks wrote Aug 27, 2015 at 4:51 PM

Adding additional attachment

lckuiper wrote Oct 26, 2015 at 12:07 PM


I am facing an issue like this. I created multiple docx documents which I merged together using InsertDocument(..) using this (very nice) docx package.

Note: Most of the errors in docx creation I encounter are exposed by converting the generated docx file to a PDF file by using PDF conversion in Gembox.Document. Microsoft Word has a lot of recovery mechanisms for an invalid document structure which other software may have not.

The Gembox.Document guys mailed me this:
The problem is with reading this file's Abstract Numbering Definitions. These elements specify a set of properties for numbered paragraphs and they must contain a unique ID attribute ("abstractNumId"). In this file there is one Abstract Numbering Definition with a "0" ID and additional four Abstract Numbering Definitions with a "1" ID.


wrote Oct 26, 2015 at 12:35 PM

lckuiper wrote Oct 26, 2015 at 12:39 PM

BoucherS wrote Apr 21 at 4:58 PM


Xceed has this in the commercial version 1.2 (coming out soon, here: Since CodePlex is shutting down, this bug fix will eventually make its way to GitHub in DocX community edition. It will be one at least a version behind the commercial version, though. We are working on the move in May.