Problem in creating new content

Topics: Developer Forum, User Forum
Jan 18, 2010 at 10:32 AM


Am working on an applciation which is already having a functionality where in they are using word templates to generate letters.

My responsibility is to insert couple pf more elements in the header section.

I tried creating these elements(textbox) in the header. The using content control kit I gave XPath values. When I am trying to generate the letters the below line of code fails

Dim pkgdata As PackagePart = TemplatePackage.CreatePart(uriData, "application/xml")

The exception comes is "Cannot add part for the specified URI because it is already in the package."

My data already contains the XML tag for the new element had added.


Could any one please help me to resolve this problem?

Jan 31, 2010 at 6:15 AM

Hi Abinashpatr

It seems you are creating a new xml part with the same URI (the first parameter to CreatePart). If you make it unique, the problem should go away.

It seemed other had a related trouble before, here's a reference: