Solved

View a Word document in Delphi application

Posted on 2000-03-12
11
440 Views
Last Modified: 2010-04-04
I whant to view a Word document in my application without opening Word. Is it possible and how to do it?

Dag
0
Comment
Question by:dikonsult
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 25

Expert Comment

by:Mr_Peerapol
ID: 2609422
Listening ...
0
 

Accepted Solution

by:
pellelil earned 50 total points
ID: 2609590
I doubt any has written a "word viwer" component, so that you can view the file without using word. However using OLE/COM you can ask WORD (if installed on the PC) to do the work for you.

A Quick-and-Dirty solution would be to insert a TOleContainer (found in the "Systems" note tab) into an form. Double-click the OleContaine and set it up for "Microsoft Word Documents"
0
 

Author Comment

by:dikonsult
ID: 2610371
Yes it work with a OLEcontainer and to open the file with OLEcontainer.CreateLinkToFile(filename,false)
but

do you know how to scroll the document?

0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Expert Comment

by:pellelil
ID: 2611129
I have never tried it, but I guess that using COM you can ask WORD to perform the scroll.
0
 
LVL 3

Expert Comment

by:raidos
ID: 2612356
I suppose OleContainer.OleObject.Application.ActiveWindow.ActivePane.VerticalPercentScrolled := Integer; would scroll it.. for you, not sure though.

Good luck
//raidos
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2613005
listening...
0
 

Author Comment

by:dikonsult
ID: 2613108
Forgive a beginner, but what do you mean with "Listening"
0
 

Author Comment

by:dikonsult
ID: 2613150
No
OleContainer.OleObject.Application.ActiveWindow.ActivePane.VerticalPercentScrolled := Integer;
did not work, getting a error message telling "Interface not supported"
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2623083
listening means that i'm interested in the subject and want to be informed
if there's an answer to the topic
0
 

Author Comment

by:dikonsult
ID: 2624974
This works

     OleContainer1.CreateObjectFromFile(DataModule1.TestOrderQueryDocument.AsString,false);
     OleContainer1.DoVerb(ovShow);
     TabSheet2.SetFocus;

The TabSheet2.SetFocus; is a quick and dirty method to get rid of the Word menu since I use a TabSheet that can't be locked.

I'm not satisfied since it is a very slow method.
I would rather use
OLEcontainer1.CreateObject(Word.Document.8);
OLEcontainer1.Run;
in Form1.Create
and then open the documents directly in the OLEcontainer.

But I don't know how to open a document without using Word open dialog.
0
 

Expert Comment

by:pellelil
ID: 2626822
How about using COM ?

Var
  S, TmpS : string;
begin
  Try
    VarW := CreateOleObject('Word.Basic');
  except
    ShowMessage('Microsoft Word is not installed');
  end;
  VarW.AppShow;
  VarW.FileOpen('somefile.doc');
  ...

This will open word, however I don't know how to use COM to open it into your container, however I guess is possible (somehow)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 103
How to debug For loops? 3 49
DBGrid or StringGrid ? 6 88
Tvertscrollbox like a whatsapp layout 5 27
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question