Problems with Delphi3/QuickReport

Posted on 2004-10-06
Medium Priority
Last Modified: 2008-01-09
Hi there,

I'm in a situation where I'm forced to used Delphi3 and QuickReport. Things are working "fine", but I have 2 major problems:

1. I have several QRSubDetailBand's with a QRMemo as the bottom component. These memo's are set to autostretch, and it works fine as long as the text put into the memo's doesn't include empty lines. When there's an empty line in the text, the following text isn't shown. IS there a way around that ?

2. I need a way to ensure that a QRSubDetailBand isn't split up, i.e. that the entire band is printed on the same page. How do i acchieve that ?

best regards

NB: As mentioned I'm FORCED to use Delphi 3 and QuickReport, so comments telling me that there are better products to use are both irrelevant and annoying, so please save them for another occasion.

Question by:NetGeek
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

Expert Comment

ID: 12237787
1. QRMemo

you can delete empty lines form your QRMemo in TQRBand beforeprint event

2. I need a way to ensure that a QRSubDetailBand isn't split up, i.e. that the entire band is printed on the same page. How do i acchieve that ?

you can use LinkBand property to link your QRSubDetailBand  to another band. two of them will be printed on the same page
if you have not such band (for link) create new band with 0 height

Expert Comment

ID: 12247726
Try something like this, it was working in delphi 4-7. With this code I was certain that my document have one detail on page where is summary band. you can modify it do do what you need.

unit Unit1;


  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QuickRpt, QRCtrls, ExtCtrls;

  TF1QuickRep = class(TQuickRep);
  TForm1 = class(TForm)
    QuickRep1: TQuickRep;
    PageHeaderBand1: TQRBand;
    TitleBand1: TQRBand;
    ColumnHeaderBand1: TQRBand;
    DetailBand1: TQRBand;
    SummaryBand1: TQRBand;
    PageFooterBand1: TQRBand;
    QRMemo1: TQRMemo;
    ChildBand1: TQRChildBand;
    ChildBand2: TQRChildBand;
    ChildBand3: TQRChildBand;
    procedure SummaryBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    { Private declarations }
    { Public declarations }

  Form1: TForm1;


{$R *.dfm}

procedure TForm1.SummaryBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
  if TF1QuickRep(QuickRep1).AvailableSpace
     <= (round(ChildBand1.Size.Height)+
         round(ChildBand3.Size.Height)) then


Author Comment

ID: 12256751
vadim_ti >> your solution to 1 won't work. I need to display the empty lines in the memo. The user has entered text in a BLOB-field, and I can't edit that text (well, I could, but then the user gets mad ;). I'm going to try inserting a space in all empty lines and then see how it behaves.

cula99 >> that looks VERY interessting, I'll have a go at that one (shouldn't all the childbandx have TF1QuickRep.Childbandx ?)

take care
Technology Partners: 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!


Author Comment

ID: 12257710
hmm, I tried to replace all empty lines with spaces, and now i get all the lines printed, except the ones with a space :(. QuickReport apparently trims the lines and throws away lines wihtout any text. How the h... do i prevent this ?

cula99 >> :( QuickReport in Delphi3 doesn't understand TF1QuickRep, and the normal  TQuickRep doens't have availablespace as a property

any other ideas ?

Expert Comment

ID: 12261136
You might try a QRRichText component and use "white" text instead of a space or blank line.  You'll need to add other symbols as indicated by the following plain and rich text versions of the same text. Incidentally, I used WordPad to create the sample rich text - don't use Word, because it adds lots of garbage.

This is a test of a white formatted word
In the line above is the word white


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\colortbl ;\red255\green255\blue255;}
\viewkind4\uc1\pard\f0\fs20 This is a test of a white formatted word\par
\cf1 white\par
\cf0 In the line above is the word white\par


Author Comment

ID: 12262869
chuck >> sounds interessting. couldn't i just add the text line for line and use selattributes on the QRMEmo ?


I'm not really happy about the TQRMemo though. I've had situation where the component doesn't display its text in preview, but prints it out just fine.

Expert Comment

ID: 12263201
That sounds like a cleaner way of achieving the same result - writing text with "invisible ink".

Another idea occurred to me. Experiment with control characters (<32) or extended ascii (>127) to use in the "blank" line in the standard QRmemo.  In particular, look at 255 - it shows up blank in some fonts.

Expert Comment

ID: 12263372
I tested one of my projects that uses a QRMemo.

I inserted chr(1) through chr(31) and chr(127) through chr(255) in a QRMemo control.   Only a chr(160) looked "blank".  I inserted a line with only a chr(160) in it between lines that contained text, and it provided a "blank" line in the preview and the printout.

My QRMemo component is using "Arial" font.  Also, I'm using Delphi 7 and the latest version of Quick Reports (standard included version).  Your mileage may vary.


Author Comment

ID: 12295681
Chuck, you're an absolute star !! chr(160) did the trick :) I only tried with chr(1) to chr(31), I never thought about the extended characters ;)

If you could just find a way to keep a SubDetailBand on the the same page, I could give you the whole load of points *hint hint* ;)

take care

Accepted Solution

cqhall earned 2000 total points
ID: 12309153

You might be able to do something like this in the QRSubDetail's BeforePrint event:

if QRSubDetail1.Size.Height+QuickRep1.CurrentY>QuickRep1.Page.Length then

I couldn't test this because I populate QRSubDetail1 in its BeforePrint event and the height property doesn't reflect the true (dynamic) height at that point.  If you have the same situation, then you'll need to figure out the dynamic height of the control (i.e., number of lines x line height).


Author Comment

ID: 12317140
HI Chuck,

I think you are on to something here. I populate the SubDetailBand in onBeforePrint aswell, but I didn't know about the currenty property. I should be able to figure something out using that property as you described. Thanks a bunch :=)

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

764 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