Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

About Memo Printing

Posted on 1998-12-10
3
Medium Priority
?
1,322 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 80 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Screencast - Getting to Know the Pipeline
Suggested Courses

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