Solved

Read MS Word Doc into A Memo Field

Posted on 2003-11-22
10
312 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

937 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

3 Experts available now in Live!

Get 1:1 Help Now