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

Error adding subdocuments to a maindocument

Dec 8, 2009 at 9:33 AM

Hi Cathal,

When I add a second subdocument (SubDocument_2) to a main document I get a duplicate key.

I use the following code

<font size="2" color="#008080"><font size="2" color="#008080">

DocX 

</font></font><font size="2" color="#008080">

 

</font>

DocX_Document_Main = null;

DocX DocX_Document_Sub = null;

<font size="2">

DocX_Document_Main =

</font>

DocX.Load(MainDocument);

DocX_Document_Main.InsertDocument(SubDocument_1);

DocX_Document_Main.InsertDocument(SubDocument_2);

I get the following error

Er is al een item met dezelfde sleutel toegevoegd(duplicate key).:    bij System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)

   bij System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

   bij System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)

   bij System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)

   bij Novacode.DocX.RebuildCustomProperties(DocX document)

   bij Novacode.DocX.InsertDocument(DocX document)

Do you have any idea how to solve this issue. 

<font size="2">

Thanks,

Johan Laagland

 

</font>