none
customXml during insertXml question RRS feed

  • Question

  •  

    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

    Wednesday, September 12, 2007 9:13 PM

Answers

  • 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 somethign that was a hybrid between the 2nd and 3rd.  Once I wrapped my wordML with the flat package xml it worked fine-

    D

    Saturday, September 15, 2007 9:32 PM

All replies

  • 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 somethign that was a hybrid between the 2nd and 3rd.  Once I wrapped my wordML with the flat package xml it worked fine-

    D

    Saturday, September 15, 2007 9:32 PM
  • hi demi,

     

                could you give a full code of yours because i need it for one of my task.

     

     

    thank you.

     

    regards,

    Dinesh.

    Friday, March 28, 2008 10:53 AM