Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

View a Word document in Delphi application

Posted on 2000-03-12
11
447 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

837 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