Solved

About Memo Printing

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

22 Experts available now in Live!

Get 1:1 Help Now