Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / May 2005

Tip: Looking for answers? Try searching our database.

Setting Saved property does not prevent Save changes dialog box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuck Hartman - 25 May 2005 23:59 GMT
My VSTO project is having another problem when Word opens a document from a
URL when being hosted by IE.  Almost immediately
the project calls the ThisDocument.SaveAs() method to give the document a
new name and
to make sure that the document is not in a read-only state.
The client is then free to edit the document.  When done, they use a
"publish" button
on my Actions Pane that calls the ThisDocument.SaveAs() method twice to save
the document into the client's local Temp directory in two different
formats.  It
then sends both copies of the document back to the server via an HTTP POST
request from a WebClient object.  That all works fine.

The issue occurs when the client navigates IE away from the open Word
document, either forward to a new URL or backward via the browsers Back
button.  If (and only if) changes have been made to the original document
opened by IE, they get asked whether or not they want to save changes.  On
the surface this is not totally unexpected, however, a workaround suggested
in several
MSDN articles, I am setting the ThisDocument.Saved property to true during
my BeforeClose event handler (and also MANY other places in my code) to
avoid that dialog box.  The original document read from the URL
should not have had any changes made to it as the first thing the project
did was to save it to a new name.
My project knows whether the document is dirty and would like to have full
control of all document saving.

It appears that the BeforeClose event is NOT being raised for my copy of the
ThisDocument object prior to the dialog box being presented.  Separately, I
have also noted that if I press the Save button on Word's Standard
CommandBar, the BeforeSave event is not raised.  This makes be believe that
my VSTO project's ThisDocument object is a copy of the document object
opened by IE
and not the actual document object.  It also appears that some of the
document's
properties and events are being handled elsewhere and they are not being
reflected to my VSTO project.

If I could understand better what is happening here, I might have hope of
developing a workaround.  If you would like me to move this discussion to
another thread or to another newsgroup, please let me know where you think
it should go. Thanks again for your past assistance.

Chuck Hartman
Iouri Simernitski (MS) - 27 May 2005 01:11 GMT
Chuck,
it sounds like this problem is an old acquaintance of mine.
http://groups-beta.google.com/group/microsoft.public.vsnet.vstools.office/br
owse_thread/thread/de2c2bdf1aa02e2f/6a42f762b7be237e

I hope this workaround is acceptable for you. BTW, you can pass null as the
filename, which would save to the last file the document was saved to.

iouri
Signature

This post is provided "AS IS" with no warranties, and confers no rights

Chuck Hartman - 31 May 2005 22:19 GMT
Iouri,

I have a few more cases to try, but it looks like this going to work. It
also may give me another approach to try for my CommandBar problem.
Thanks!!

Chuck Hartman

> Chuck,
> it sounds like this problem is an old acquaintance of mine.
[quoted text clipped - 6 lines]
>
> iouri

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.