Automate Document Save

M

Marco Moioli

Hi, I want to develop a C# add-in that automaticaly save in xml format the
document that I open.
I have a method that "save as xml" the Active Document but I don't know how
can I call it.

If I call it in "OnStartupComplete" it doesn't work.

public void OnStartupComplete(ref System.Array custom)
{
SaveDocumentAsXml();
}

There is a way to hook an event like "OnDocumentLoad"?

Thanks!
Marco
 
C

Cindy M -WordMVP-

Hi Marco,
I want to develop a C# add-in that automaticaly save in xml format the
document that I open.
I have a method that "save as xml" the Active Document but I don't know how
can I call it.

If I call it in "OnStartupComplete" it doesn't work.

public void OnStartupComplete(ref System.Array custom)
{
SaveDocumentAsXml();
}
Does it return an error message? Generally, in template addins, when trying to
perform an action Word isn't able to support yet, we trap the error and loop
until it is allowed (or a counter hits a set value, so that we don't end up in
an infinite loop). If this isn't returning an error, you might try doing
something else that isn't "allowed" that will return an error.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
F

Fredrik Wahlgren

Cindy M -WordMVP- said:
Hi Marco,

Does it return an error message? Generally, in template addins, when trying to
perform an action Word isn't able to support yet, we trap the error and loop
until it is allowed (or a counter hits a set value, so that we don't end up in
an infinite loop). If this isn't returning an error, you might try doing
something else that isn't "allowed" that will return an error.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


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

For which application is the add-in made. Why not create a custom menu with
a menu item called SaveAsXML?

/ fredrik
 

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