Demi Z

Hi all,

I've been pulling my hair out with this one. I'm trying to insert some wordML to an open Word 2007 docx file via a VSTO addin. All goes well until I try inserting some WordML that has customXml in it.

If my xml is this:

string xml=

Code Snippet

<w:document xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'>

<w:body>

<w:p>

<w:customXml w:uri='http://www.myURI.com/stuff' w:element='rel'>

<w:customXmlPr'>

<w:attr w:name='value' w:val='2' />

</w:customXmlPr>

<w:r><w:t>text</w:t></w:r>

</w:customXml>

</w:p>

</w:body>

</w:document>

and I do a-

Code Snippet
currentRange.InsertXml(xml, ref missing);

the string "text" is inserted into my word document at the appropriate location, but the customXml wrapper tags are missing.

Does anybody have any ideas as to why this is

Thank you SO much for reading,

D



Re: Visual Studio Tools for Office insertXml losing customXml tag

Demi Z

I discovered the problem with this. insertXml takes custom tags, wordML or the flat package schema associated with docx files. I was trying to insert something that was a hybrid between the 2nd and 3rd. Once I wrapped my wordML with the flat package xml it worked fine-

D