Solved

Read MS Word Doc into A Memo Field

Posted on 2003-11-22
10
309 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now