Board index » delphi » close Word document without possibilty of saving

close Word document without possibilty of saving

Hi,

I've got to make an application in wich I can open Word documents. Users
must be able to read these an then close them. The problem is that the
documents can be changed. In the delphi-application now I show the
Word-document in a window  without any toolbars,buttons or a menu. But the
user can still change things in the document, when the users closes the
document he's getting a question if he wants to save these changes, and
that's not wanted!

So, can I get rid of this question after closing the document?

I know I can open the documets in Word as readonly so the user can't
overwrite the document, but he can still save it under another name or
directory.

So if there's someone who can help how to solve this problem, please help
me.
thanks

 

Re:close Word document without possibilty of saving


Hi paul,

I just copy pasted some code from my source, it should help you, code to
close ALL documents from Word, set prompt to save or not.

     if Prompt then
       SaveChanges := -2  //wdPromptToSaveChanges = -2
     else
       SaveChanges := 0; //wdDoNotSaveChanges = 0
     OriginalFormat := 0; //wdWordDocument = 0
     RouteDocument := False;
     Visible := GWord80.Visible;

     if not (GWord80.Windows.Count = 0) then
       begin
       for i := GWord80.Windows.Count downto 1 do
         begin
         Index := i; ///???
         GWord80.ActiveWindow.Close(SaveChanges, RouteDocument);
         end;
       GWord80.Visible := Visible;
       end;

Paul v Mullekom <pvmDel...@hotmail.com> wrote in message
news:7v9d32$67m4@forums.borland.com...

Quote
> Hi,

> I've got to make an application in wich I can open Word documents. Users
> must be able to read these an then close them. The problem is that the
> documents can be changed. In the delphi-application now I show the
> Word-document in a window  without any toolbars,buttons or a menu. But the
> user can still change things in the document, when the users closes the
> document he's getting a question if he wants to save these changes, and
> that's not wanted!

> So, can I get rid of this question after closing the document?

> I know I can open the documets in Word as readonly so the user can't
> overwrite the document, but he can still save it under another name or
> directory.

> So if there's someone who can help how to solve this problem, please help
> me.
> thanks

Re:close Word document without possibilty of saving


When I open a type library, created in D3 in D4, I get hints like:
Parameter 'vStatus' in IGator.MidGetWork changed to 'vStatus_'
This hints do not dissapear after I say 'Refresh'. I also see no changes in
the type library code, it still looks like:

function MidGetWork(var strAgentID: WideString; var vCallback, vAgent,
vWork, vRefObject, vStatus: OleVariant): Integer [dispid $0000000D];
safecall;
^^^^^^^

What I have noticed, is that all parameters mentioned in hints are the last
in functions definitions.  What is happening, I wonder?

Re:close Word document without possibilty of saving


Hi Paul

i have also show a word-Document in a window without Menu and Toolbars. To
avoid that the user can make changes or word use any shortcuts i have
disable the Userinterface in Word. So the User can look at the
word-document, can Scroll with the Scrollbars through the Document but
cannot make any othe word-operations via Shortcuts ...

In the IOLEDocumentSite.ActivateMe-Function i have called the
UIActivate(True) and then direct then UIActivate(False)-Procedure.

regards from Ingolf Bayer

Paul v Mullekom schrieb in Nachricht <7v9d32$6...@forums.borland.com>...

Quote
>Hi,

>I've got to make an application in wich I can open Word documents. Users
>must be able to read these an then close them. The problem is that the
>documents can be changed. In the delphi-application now I show the
>Word-document in a window  without any toolbars,buttons or a menu. But the
>user can still change things in the document, when the users closes the
>document he's getting a question if he wants to save these changes, and
>that's not wanted!

>So, can I get rid of this question after closing the document?

>I know I can open the documets in Word as readonly so the user can't
>overwrite the document, but he can still save it under another name or
>directory.

>So if there's someone who can help how to solve this problem, please help
>me.
>thanks

Other Threads