Solved

About Memo Printing

Posted on 1998-12-10
3
1,252 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 184
enhance the following code 3 42
shape, triangle, dbctrlgrid 3 31
Way to create an iPhone app for my customers 8 44
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

749 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