Solved

How to print a trichEdit with quickReport

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

Independent Software Vendors: 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

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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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