?
Solved

View a Word document in Delphi application

Posted on 2000-03-12
11
Medium Priority
?
465 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
[X]
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
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 25

Expert Comment

by:Mr_Peerapol
ID: 2609422
Listening ...
0
 

Accepted Solution

by:
pellelil earned 150 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: 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.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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