Solved

How to print a trichEdit with quickReport

Posted on 1998-07-15
2
873 Views
Last Modified: 2013-11-22
Hi,
I want to print the containt of a trichtext in a tqrrichEdit.
The only way I found to make it work is the following :

     beforeEdit.Lines.SaveToFile('Before.rtf');
     backEdit.Lines.SaveToFile('Behind.rtf');
     form2.QRbackEdit.Lines.LoadFromFile('Behind.rtf');
     form2.QRbeforeEdit.Lines.LoadFromFile('Before.rtf');
     form2.jacket.Print;
     
The problem is that the text seems to be stretched even with true type
fonts.

I know that I have to link the parentRichEdit property to my trichedit. But if
I do so, the text prints very small, like when you ask a trichedit to print.

At the printpreview the text looks like it should, but I know it's normal :
96 dpi on the screen and 600dpi on the printer.

So, how do I properly print the contain of a trichedit with the help of a
tqrrichedit. What's the right and working method ?
Thanks for your help.
0
Comment
Question by:jeurk
[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 Comments
 
LVL 1

Expert Comment

by:Greedy
ID: 1357940
This is how I do it...This is for if the RTF data was stored in a database but if you have it stored in another string then create the stream off that instead.  The only other thing I do is set AutoStretch to True and set the Height to 20...but that's just normal stuff.

var
  MyStream : TStringStream;

begin
  MyStream := TStringStream.Create(Table1.FieldByName('YourFieldHere').AsString + #13 + #10);
  QRRichText1.Lines.Clear;
  QRRichText1.Lines.LoadFromStream(MyStream);
  MyStream.Free;
end;

0
 
LVL 10

Accepted Solution

by:
Jacco earned 50 total points
ID: 1357941
I know this problem. It is a bug in QRReport... and has not been resolved in the updates yet...

I only have a work around that works for me.

The band on which you have the TQRRichEdit should have a BeforePrint method assigned and look like this:

procedure TrepBill_01.SummaryBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
var
  sLine : String;
  sKey  : String;
  iCount : Integer;
  iPos : Integer;
begin
  if (Abs(TotalToBePayed)<0.01) or
     (FPayment<>'DEBITEUR') or
     (FBillType in [btPFGuest,btPFCompany,btPFAlternative]) then begin
    reMemo.DefAttributes.Size:=9;
    reMemo.DefAttributes.Name:='Arial';
    reMemo.WordWrap:=False;
    if (sLanguage='EN') or (sLanguage='FR') or (sLanguage='DU') then
      reMemo.Lines.LoadFromFile(HotConDir + '\Editor\bott_fact_cont_' + sLanguage + '.rtf')
    else
      reMemo.Lines.LoadFromFile(HotConDir + '\Editor\bott_fact_cont.rtf');
  end else begin
    reMemo.DefAttributes.Size:=9;
    reMemo.DefAttributes.Name:='Arial';
    reMemo.WordWrap:=False;
    if (sLanguage='EN') or (sLanguage='FR') or (sLanguage='DU') then
      reMemo.Lines.LoadFromFile(HotConDir + '\Editor\bott_fact_deb_' + sLanguage + '.rtf')
    else
      reMemo.Lines.LoadFromFile(HotConDir + '\Editor\bott_fact_deb.rtf');
  end;
  // Recalculate Summary band size
  SummaryBand1.Height := 100 + (1 + reMemo.Lines.Count)*17;
  qrrtMemo.Height     := SummaryBand1.Height - 100;
  reMemo.WordWrap:=True;
  qrrtMemo.ParentRichEdit:=reMemo;
  qrResFol.Close;
end;

Note: If you use the preview of QRReport the memo still will not show up properly! But on the printer it will.
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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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