P
paulp
I'm developing an addin for Word 2007 and I need to determine whether a user
saves a Word 2007 document in an older format (97-2003) after a save as is
done. The scenario is that the user starts out with a Word 2007 document,
saves that document to disk, then saves the same document in an older format
If the user saves a doc in an older format, I want to turn off certain
features of my add-in. I'm able to trap the save event easily enough and
provide the user with the Save as dialog and process the document type after
the save is completed. Here's a code snippet:
void _appClass_DocumentBeforeSave(Microsoft.Office.Interop.Word.Document
Doc, ref bool SaveAsUI, ref bool Cancel)
{
if (SaveAsUI == true)
{
string _origName = Doc.FullName;
Cancel = true;
object missing = Type.Missing;
Word.Dialog fileSaveAsDlg =
Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
fileSaveAsDlg.Show(ref missing);
if (Doc.FullName != _origName)
{
...do stuff
}
... check document version type
}
}
The problem is that Word 2007 supports save as dialogs for specific document
types but the only save as dialog I can produce above is a generic one that
defaults to the new file format. To produce a format-specific dialog, click
Word's Office button, then click Save As and you're presented with the option
of saving as a variety of document types.
If I take the approach above, I break this very helpful feature because even
though the user may have selecte to save as Word 97-2003 format, she still
gets the save as dialog defaulting to the Word 2007 format and has to
manually change it. However there is no way I've discovered to determine
which type of save as box the user intended and even if I could, I don't know
how to produce a save as dialog that matches the user's choice.
There also doesn't seem to be any post-save events so I can't process the
document type after the save event has completed. This seems to be a
deficiency in the Word 2007 object model.
Can anyone provide any guidance on a decent work-around for this? I want to
be able to fully support the Word 2007 functionality of being able to provide
the user with a document type-specific save as dialog while still being able
to trap the save event and process the document after the save (specifically
the save as) event has completed.
Thanks
saves a Word 2007 document in an older format (97-2003) after a save as is
done. The scenario is that the user starts out with a Word 2007 document,
saves that document to disk, then saves the same document in an older format
If the user saves a doc in an older format, I want to turn off certain
features of my add-in. I'm able to trap the save event easily enough and
provide the user with the Save as dialog and process the document type after
the save is completed. Here's a code snippet:
void _appClass_DocumentBeforeSave(Microsoft.Office.Interop.Word.Document
Doc, ref bool SaveAsUI, ref bool Cancel)
{
if (SaveAsUI == true)
{
string _origName = Doc.FullName;
Cancel = true;
object missing = Type.Missing;
Word.Dialog fileSaveAsDlg =
Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
fileSaveAsDlg.Show(ref missing);
if (Doc.FullName != _origName)
{
...do stuff
}
... check document version type
}
}
The problem is that Word 2007 supports save as dialogs for specific document
types but the only save as dialog I can produce above is a generic one that
defaults to the new file format. To produce a format-specific dialog, click
Word's Office button, then click Save As and you're presented with the option
of saving as a variety of document types.
If I take the approach above, I break this very helpful feature because even
though the user may have selecte to save as Word 97-2003 format, she still
gets the save as dialog defaulting to the Word 2007 format and has to
manually change it. However there is no way I've discovered to determine
which type of save as box the user intended and even if I could, I don't know
how to produce a save as dialog that matches the user's choice.
There also doesn't seem to be any post-save events so I can't process the
document type after the save event has completed. This seems to be a
deficiency in the Word 2007 object model.
Can anyone provide any guidance on a decent work-around for this? I want to
be able to fully support the Word 2007 functionality of being able to provide
the user with a document type-specific save as dialog while still being able
to trap the save event and process the document after the save (specifically
the save as) event has completed.
Thanks