Link to home
Start Free TrialLog in
Avatar of shrldu
shrldu

asked on

D1 - How to view Word 6 documents from Delphi? (read only mode)

(D1 and Win 3.1) I want to enable viewing Winword 6 documents from my Delphi application. I can use for instance OLE container, but how to implement read only mode? The user should be able to see the document, scroll through all its pages but not to change its content.
Thank you.
ASKER CERTIFIED SOLUTION
Avatar of icampbe1
icampbe1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hpierson
hpierson

If your user already has word on their PC, add the unit

shellapi

to your uses clause.

the follwoing two lines will do what you want:

filesetattr('c:\yourdir\yourdoc.doc', faReadOnly);
shellexecute(application.handle, 'OPEN'#0, 'c:\yourdir\yourdoc.doc'#0, NIL, 'c:\yourdir'#0, sw_showmaximized);

Your user will be able to make changes in the document on the screen, but will not be able to overwrite yourdoc.doc if they try to save.