[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to print a trichEdit with quickReport

Posted on 1998-07-15
2
Medium Priority
?
888 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 100 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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 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