none
processing of Custom XML tags in word 2003,2007 and 2010 RRS feed

  • Question

  • Hi Guys,

        I am new to word programming, I am looking for the ways to remove unwanted custom xml tags from word document, and the document could be created through word 2003/2007 or 2010.

    Please suggest...

    Thanks in advance/Salim

                   


    sk

    Thursday, February 9, 2012 11:13 AM

Answers

  • Hi Salim

    <<A: No, I want do this when document is ready for processing after all the edits.>>

    So, you want to do this before the document is allowed to close/print/save (which)?

    And by "custom XML tags" you mean the things the user can drag from the XML Structures task pane onto the document surface? (I just want to be sure we're on the same wave-length, here.)

    Do you want to retain anything typed into the tags? Or should the content also be removed?

    Assuming we're talking about the same thing, the basic object you'll be working with is the XMLNodes object depending from the Document object: Document.XMLNodes[index].Delete()

    This removes the XML Node and leaves the text.

    This can be used in C#, but if you need to integrate with the application interface (while the user is working) it would be best to use a VSTO solution. If this is going to be with a specific document type, then a VSTO document or template; if it could be with any document, then a VSTO Add-in.

    The MSDN documentation on VSTO can be found here: http://msdn.microsoft.com/en-us/library/d2tx7z6d.aspx


    Cindy Meister, VSTO/Word MVP

    • Marked as answer by discoversk Thursday, February 23, 2012 2:18 PM
    Friday, February 10, 2012 7:51 AM
    Moderator

All replies

  • Hi Salim

    Which version of Word are you targeting?

    Do you want to be doing this while the user is looking at the document?

    Word 2007 and Word 2010 should be removing these tags automatically when a document is opened, as the feature has been deprecated and the underlying functionality removed...


    Cindy Meister, VSTO/Word MVP

    Thursday, February 9, 2012 3:54 PM
    Moderator
  • Hi Cindy,

    Here is the information which you had asked.

    Q: Which version of Word are you targeting?

    A: Word 2003 (if I could do the same with 2007 and 2010 word it would be really great)

    Q: Do you want to be doing this while the user is looking at the document?

    A: No, I want do this when document is ready for processing after all the edits.

    Finally, I would like to create an application in C# to do this, but at this point not sure what the best way to do it.

     


    Salim

    Friday, February 10, 2012 5:22 AM
  • Hi Salim

    <<A: No, I want do this when document is ready for processing after all the edits.>>

    So, you want to do this before the document is allowed to close/print/save (which)?

    And by "custom XML tags" you mean the things the user can drag from the XML Structures task pane onto the document surface? (I just want to be sure we're on the same wave-length, here.)

    Do you want to retain anything typed into the tags? Or should the content also be removed?

    Assuming we're talking about the same thing, the basic object you'll be working with is the XMLNodes object depending from the Document object: Document.XMLNodes[index].Delete()

    This removes the XML Node and leaves the text.

    This can be used in C#, but if you need to integrate with the application interface (while the user is working) it would be best to use a VSTO solution. If this is going to be with a specific document type, then a VSTO document or template; if it could be with any document, then a VSTO Add-in.

    The MSDN documentation on VSTO can be found here: http://msdn.microsoft.com/en-us/library/d2tx7z6d.aspx


    Cindy Meister, VSTO/Word MVP

    • Marked as answer by discoversk Thursday, February 23, 2012 2:18 PM
    Friday, February 10, 2012 7:51 AM
    Moderator
  • Hi,

    When I use Document.XMLNodes[index].Delete() to remove XML tags, it takes lot of time;

    Win-7+ word 2010: 7-8 seconds.
    Win 2003 server + word 2003 take 8-10 seconds
    Win 2008 + word 2008 take more than 10 seconds.

    The document contains 536 XML nodes in Document.XMLNodes collection.  Is there any way to increase the performance/alternate option?


    Thanks


    Salim

    Thursday, May 10, 2012 12:54 PM