Solved

Copy text from memo into text file

Posted on 2004-04-28
3
440 Views
Last Modified: 2011-09-20
How to copy out all the text from a memo into a text file?
0
Comment
Question by:cybermilky
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 25 total points
Comment Utility
memo1.lines.savetofile('YourFileNameHere.txt');
0
 
LVL 3

Expert Comment

by:MikProg
Comment Utility
Memo1.Lines.SaveToFile( ... );
0
 

Expert Comment

by:meadorj
Comment Utility
The easy way is to do:
  memo1.lines.savetofile('YourFileNameHere.txt');
If you want to do it the hard way you would have to do;
procedure Write;
var
  F1 : TextFile;
  i : Integer;
const
  FILENAME : string = 'C:\somefile.txt';
begin
  AssignFile(F1,FILENAME);
  Rewrite(F1);
  for i := 0 to memo1.lines.count-2 do begin
    writeLn(F1,memo1.lines.strings[i]);
  end;
  write(F1,memo1.lines.strings[i]);
  CloseFile(F1);
end;

And you just call this procedure when you need to write the text to a file.  I would use the easy way unless you are saving any header or footer information.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 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

12 Experts available now in Live!

Get 1:1 Help Now