MS Word Automation - DocumentBeforeSave event

C

compborg

I have been using word automation to interact with documents located in a web
server. My problem is "SaveAsUI" is always true in DocumentBeforeSave event
(even when user selects "save" option). This is not happening on all systems.

Is there a setting that would trigger this behavior?

I am working against Office 11 PIAs. The system that has the issue is Win XP
Pro + Office 2003 SP3.

Here is how I open the document:

public override bool OpenDocument(DocumentEventArgs args)
{
try
{
//Start Word and create a new document.
MSWord._Application app = GetWordApplication();
MSWord._Document oDoc;
app.Visible = true;
object fileName = args.WorkingFileName;
object oMissing = System.Reflection.Missing.Value;
oDoc = app.Documents.Open(ref fileName,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing);
LogInfo("{0}: Opened document {1}", new object[] {
args.DocumentId, oDoc.Name });
return true;
}
catch (Exception exc)
{
if (logger.IsDebugEnabled)
{
string message = string.Format("{0}: Open document
failed.", args.DocumentId);
logger.Debug(message, exc);
}
}
return false;
}

Thanks in advance.
 

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