cancel standard save in word

Add-in Express™ Support Service
That's what is more important than anything else

cancel standard save in word
 
Tom Jones




Posts: 4
Joined: 2009-06-02
Hi, we have written a addin that follows this procedure:

- a document is opened through internet and placed in the temporary internet folder
- if the document is saved we do a save as to store it in another location

After that save as we want to cancel the standard save action, coz now it tries to save the document in the temporary internet folder also and there it doesnt have rights.

Is it possible to cancel the standard save action...?

We use the following code, in the SaveWordDocument we do the saveAs action.
I also set WordDocument.saved = true but that doesnt seems to help.


private void adxWordEvents_DocumentBeforeSave(object sender, AddinExpress.MSO.ADXHostBeforeSaveEventArgs e)
{
if (HostType == AddinExpress.MSO.ADXOfficeHostApp.ohaWord && !inSaving)
{
inSaving = true;
SaveWordDocument();
inSaving = false;
}
}
Posted 11 Jun, 2009 06:48:19 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Tom,

Use e.Cancel = true.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Jun, 2009 07:52:25 Top
Tom Jones




Posts: 4
Joined: 2009-06-02
Yes thats working!
Sometimes it can be so easy :)

Tnx
Posted 11 Jun, 2009 09:28:59 Top
Tom Jones




Posts: 4
Joined: 2009-06-02
One more question...

How todo it on an PowerPoint save...?

private void adxPowerPointEvents_PresentationSave(object sender, object hostObj)
Posted 11 Jun, 2009 09:40:26 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You need to use another event called PresentationBeforeSave. Note that saving in this event causes an exception to the best of my knowledge. You need to start a timer and save the presentation in the timer event.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Jun, 2009 11:21:53 Top