Solved

Read MS Word Doc into A Memo Field

Posted on 2003-11-22
10
321 Views
Last Modified: 2010-07-27
how can I read a MS word document into a memo field.

I am using the scalbium component, which works mostly, hence i am seeking an alternative method that works all the time.

Thanks in advance.

0
Comment
Question by:delphinewbie
[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
  • 5
  • 4
10 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9805723
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9808284
good page FAQ Delphi/MSWord
http://www.softmosis.ca/WordFAQ.html#GetData
0
 
LVL 1

Author Comment

by:delphinewbie
ID: 9808933
Scalabium have made available an update to their component that works on 854 of 855 tested documents.

I will still award points if I am provided with a working solution, not a link to a web page that talks in general about the topic and other MS products.

Although I do appreciate assistance through this forum, I can do google searches myself.
0
Industry Leaders: 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!

 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9810547
...
wd: TWordDocument;
wa: TWordApplication;
...

 Memo1.Clear;
  FileName := 'c:\temp.doc';
  wa.Connect;
  wa.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
                    EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam
  );
  wa.Visible := True;
  wd.ConnectTo(wa.ActiveDocument);
  wd.Select;
  Memo1.Lines.Add(wd.Range.Text);
  wa.Visible := False;
  wa.Disconnect;
0
 
LVL 1

Author Comment

by:delphinewbie
ID: 9816163
I assume uses word97 is required.

tried this but it crashes at:

wa.Documents.Open(MyFileName, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam);
 
I removed the EmptyParam code and left it blank.

Error - "types of actual and var parameters must be identical"

thanks for your help.


0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9817179
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Word97, OleServer, ComObj, Variants;

The sample was checked under Delphi7 with Word2002.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9817192
Just create an empty project and put 2 components (TWordApplication and TWordDocument) on the form.
0
 
LVL 1

Author Comment

by:delphinewbie
ID: 9841264
Appologies for the delay in responding -

Same error message  - same line.

I use delphi6 with word 2002
0
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 75 total points
ID: 9842316
I've checked. It works fine under Delphi6.
May be you've fogotten to create test file "c:\temp.doc"
Create the file with some text ("Test string" for example).
0
 
LVL 1

Author Comment

by:delphinewbie
ID: 9976049
Although the supplied code does not work on my pc.
Points awarded for trying.
Cheers
Brad
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

736 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