Solved

How to print a trichEdit with quickReport

Posted on 1998-07-15
2
864 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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