Word 2003 Preserve XML structure

R

Rahul

I am copying and pasting text from one word document to another
programmatically. The copied test has custom xml tags in it. How can I
programmatically instruct word to preserve or not preserve the XML structure
when the text gets pasted into another document.

Thanks
Rahul
 
C

Cindy M.

Hi Rahul,
I am copying and pasting text from one word document to another
programmatically. The copied test has custom xml tags in it. How can I
programmatically instruct word to preserve or not preserve the XML structure
when the text gets pasted into another document.
Can you be more precise, please, about what you mean by the "XML structure"?

If you mean the display in the XML task pane, a document can only display that
if it's been linked to the XML Schema. In the object model, this would be the
Add method of the XMLSchemas collection.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
R

Rahul

Cindy,

There are 2 documents both are attached to schemas. Now when i am copying
some text(there are tags in the text) from document 1 and paste into
document 2, word shows me button for paste options. One of the options in
that is to preserve XML structure. If I select the "Preserve XML structure"
option then the tags in the copied text also are copied into Document 2 and
vice a versa.

My question is how can it be done programatically. I tried to record a
Macro, but with macro recording turned on the "PreserveXML structure" option
does not even show.

I would really appreciate any help as I have run into a road block on this.

Thanks
Rahul
 
C

Cindy M.

Hi Rahul,
There are 2 documents both are attached to schemas. Now when i am copying
some text(there are tags in the text) from document 1 and paste into
document 2, word shows me button for paste options. One of the options in
that is to preserve XML structure. If I select the "Preserve XML structure"
option then the tags in the copied text also are copied into Document 2 and
vice a versa.

My question is how can it be done programatically. I tried to record a
Macro, but with macro recording turned on the "PreserveXML structure" option
does not even show.

I would really appreciate any help as I have run into a road block on this.
Aha. Never noticed this before - thanks for broadening my horizons :)

Look at the PasteAndFormat method of the Range and Selection objects. Pretty
much everything there retains the tags. The only option I tried that did not is
the wdFormatPlainText one.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top