Solved

About Memo Printing

Posted on 1998-12-10
3
1,244 Views
Last Modified: 2008-03-17
How to print the content of TMemo?
If I use TRichEdit, I can use <TRichEdit>.Print.
But I couldn't find Print method in TMemo.

Like usual, needs some guidance...

:-)

Stinger
0
Comment
Question by:stinger_60284
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 20 total points
ID: 1350457
Hi Stinger,

Form the Borland TI nr 2809

KEYWORDS: print tmemo memo tlistbox listbox lines contents AREA: VCL Programmi

Q: How can I print all of the lines within a TMemo or TListbox component?

A: The function below accepts a TStrings object as a parameter and prints
   out each string to the default printer.  Because it uses a TStrings, the
   function will work with any type of component that contains a
   TStrings-type property, such as a TDBMemo or TOutline.

{ Begin code listing }

uses Printers;

procedure PrintStrings(Strings: TStrings);
var
  Prn: TextFile;
  i: word;
begin
  AssignPrn(Prn);
  try
    Rewrite(Prn);
    try
      for i := 0 to Strings.Count - 1 do
        writeln(Prn, Strings.Strings[i]);
    finally
      CloseFile(Prn);
    end;
  except
    on EInOutError do
      MessageDlg('Error Printing text.', mtError, [mbOk], 0);
  end;
end;

{ End code listing }

To print out the contents of a TMemo or TListbox, use the following
code:

PrintStrings(Memo1.Lines);

or

PrintStrings(Listbox1.Items);


Hope this helps
Bruintje
0
 

Author Comment

by:stinger_60284
ID: 1350458
Thanks  bruintje!!!
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1350459
My pleasure.........
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 57
Firemonkey allowing RTL on android 6 46
Microsoft Access 97 and Delphi XE2 9 53
MS Access from Delphi 31 59
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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