Solved

About Memo Printing

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

23 Experts available now in Live!

Get 1:1 Help Now