[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Read MS Word Doc into A Memo Field

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
delphinewbie
Asked:
delphinewbie
  • 5
  • 4
1 Solution
 
TheLeaderCommented:
good page FAQ Delphi/MSWord
http://www.softmosis.ca/WordFAQ.html#GetData
0
 
delphinewbieAuthor Commented:
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
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!

 
GloomyFriarCommented:
...
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
 
delphinewbieAuthor Commented:
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
 
GloomyFriarCommented:
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Word97, OleServer, ComObj, Variants;

The sample was checked under Delphi7 with Word2002.
0
 
GloomyFriarCommented:
Just create an empty project and put 2 components (TWordApplication and TWordDocument) on the form.
0
 
delphinewbieAuthor Commented:
Appologies for the delay in responding -

Same error message  - same line.

I use delphi6 with word 2002
0
 
GloomyFriarCommented:
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
 
delphinewbieAuthor Commented:
Although the supplied code does not work on my pc.
Points awarded for trying.
Cheers
Brad
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now