Solved

Copy text from memo into text file

Posted on 2004-04-28
3
447 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
[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
3 Comments
 
LVL 27

Accepted Solution

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

Expert Comment

by:MikProg
ID: 10946764
Memo1.Lines.SaveToFile( ... );
0
 

Expert Comment

by:meadorj
ID: 10949908
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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