Solved

Dump *.Doc  to Text ?

Posted on 2010-11-26
5
366 Views
Last Modified: 2012-05-10
Im looking for a free or opensource component to Dump *.Doc  to Text ?

Please do not post unless you have a free or opensource method of accomplishing this.

THanks
0
Comment
Question by:Looking_4_Answers
[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
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:DonConsolio
ID: 34220492
0
 

Author Comment

by:Looking_4_Answers
ID: 34220493
Sorry, Delphi 2010
0
 

Author Comment

by:Looking_4_Answers
ID: 34220497
@DonConsolio:

NO THANKS


Actually, i would be more interested in plain ole code versus a component
0
 
LVL 24

Expert Comment

by:jimyX
ID: 34221477
Simply you can use the following code to open the doc file and copy the content to memo and/or text file:

uses ComObj, clipbrd;

procedure TForm1.Button1Click(Sender: TObject);
var
  WordApp : Variant;
  Range : Variant;
  i : integer;
  Selection : Variant;
begin
  WordApp := CreateOleObject('Word.Application');
  WordApp.Visible := false;
  Wordapp.documents.open('C:\YouDocFile.doc');
  Range := WordApp.Documents.Item(1).Range;
  WordApp.documents.item(1).select;
  WordApp.selection.copy;
  Memo1.lines.clear;
  Memo1.pastefromclipboard;
  Clipboard.Clear;
  Memo1.Lines.SaveToFile('C:\YouTextFile.txt');
  WordApp.documents.item(1).Close;
  WordApp.Quit;
end;

Open in new window

0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 34221597
Here is the code for converting without using the clipboard:

uses ComObj;

procedure TForm1.Button1Click(Sender: TObject);
const
  wdDoNotSaveChanges = 0;
var
  WordApp : Variant;
  Range : Variant;
begin
  WordApp := CreateOleObject('Word.Application');
  WordApp.Visible := false;
  Wordapp.documents.open('C:\YouDocFile.doc');
  WordApp.Selection.ClearFormatting;
  Range := WordApp.Documents.Item(1).Range;
  WordApp.documents.item(1).select;
  Memo1.Lines.Text := WordApp.selection.text;
  Memo1.Lines.SaveToFile('C:\YouTextFile.txt');
  WordApp.ActiveDocument.Close(wdDoNotSaveChanges);
  WordApp.Quit;
end;

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

734 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