QuickReport - FAQ

Top  Previous  Next

QuickReport Knowledge Base (kb)

Frequently asked Questions (and Answers) and other tips

Copyright 1998 Qusoft AS

Visit our web site at http://www.qusoft.com

You will want to turn word wrapping on when viewing this file.

Revision 2.34

Last updated on March 71999

QuickReport 3 specific items will start with the text "(Qr3)" or will appear in their own section.  Delphi 4 items will start with "(D4)"

 

 

[Adding reports and/or controls at runtime]

==================

Q.  When I use QRCreateList() it looks like it's finding fields from the current record in another dataset.  The other dataset has the same field names as the one that I am passing to QRCreateList().

A.  The problem is in the field names.  The QRCreateList adds TQRExpr controls to the report and sets the expression to the field name without the table name.  When the report runs, QuickReport searchs until it finds the first matching field name.  Without the table name, it will use the first dataset that has a matching a field name.  This is a known bug and will be addressed in a future release.  That's the bad news.  The good news is that you can easily alter the report after calling QRCreatelist and add the table name to the expression.

Example:

QRCreateList(aReport, Self, MyTable, 'Customer Listing', SomeFields);

 

{ Search the detail band for any TQRExpr controls and insert }

{ the table name after the left bracket in the expression }

 

for nIdx := 0 to aReport.Bands.DetailBand.ControlCount -1 do

  if aReport.Bands.DetailBand.Controls[nIdx] is TQRExpr then

    with TQRExpr(aReport.Bands.DetailBand.Controls[nIdx]) do

      Expression := '[' + aReport.DataSet.Name + '.' + copy(Expression, 299);

 

(QR3) This has been fixed for QuickReport 3

------------------

Q.  When I create a report at runtime and pass it to QRCreateList(), it does not use my title.

A.  This is happening because you have created the report before the call to QRCreateList.  If the report that is passed to QRCreateList is nil, then it is assumed that you want QuickReport to create the entire report for you.  If you pass in a report that has already been created, we assume that you have already formatted the report with a title, pageheader, pagefooter, etc, and that you only want QuickReport to create the detail band for you.

------------------

Q.  Using QR2 (or later) and trying to call addprintable in the beforeprint event of a band causes a GPF (or an Access Violation). Is this not allowed for some reason?

A.  You can only call AddPrintable or otherwise add a control to a report band before you start the report.  QuickReport needs to know about all printable controls before it starts the report.

------------------

Q.  I am generating report at run time and I have a question: If for example I set QuickReport.HasTitle as true it automatically creates the title band. The problem is that I won't be able to know the name of title variable that was created.

A.  You can reference it through the report's bands property like with the following example:

 

    with QuickRep1 do

    begin

      ReportTitle := 'Sample Report';

      Bands.HasTitle := true;

      with TQRSysData(Bands.TitleBand.AddPrintable(TQRSysData)) do

      begin

         Data := qrsReportTitle;

         AlignToBand := true;

         Alignment := taCenter;

      end;

 

      Preview;

    end;

 

This adds a titleband with the report's title centered on the band.  You will need to add the quickrpt and qrctrls units to the use list in the unit that has this code.

 

You can reference each band type that can be set through the HasXXXXX properties from the following list:

TitleBand

PageHeaderBand

ColumnHeaderBand

DetailBand

PageFooterBand

SummaryBand 

------------------

Q.  If you use the method AddPrintable, how can you access the control that was created?

A.  Just assign the control created by AddPrintable to a variable of that type of control.  You can then change the top and left properties by referencing that variable.

Example:

 

var

  MyCtrl : TQRSysdata;

  .....

  MyCtrl := TQRSysData(Bands.TitleBand.AddPrintable(TQRSysData));

  with MyCtrl do

  begin

     Data := qrsReportTitle;

     AlignToBand := true;

     Alignment := taCenter;

  end;

------------------

Q.  I get an error when I try to use the QRCreateList example from the manual.

A.  You must make sure to set the aReport variable to nil before calling the QRCreateList method.  This was omitted from the documentation.  The following example shows how to call this method:

 

procedure TFormMain1.btnCreateListClick(Sender: TObject);

var

  aReport : TQuickRep;

  SomeFields: TStringList;

  MyTable: TTable;

  nIdx: integer;

begin

  { Create a table on the fly, this example uses a table from the demo database }

  MyTable := TTable.Create(self);

 

  { create the list of fields to output from the table }

  SomeFields := TStringList.Create;

  with MyTable do

  begin

    DatabaseName := 'DBDEMOS';

    TableName := 'COUNTRY.DB';

    ReadOnly := True;

    Active := True;

 

    { For this example, we will pull the field names from the table }

    for nIdx := 0 to FieldCount - 1 do

      SomeFields.Add(Fields[nIdx].FieldName);

  end;

 

  { You must set the report object to nil before calling QRCreateList}

  areport := nil;

 

  { Build the report }

  QRCreateList(aReport, Self, MyTable, 'Test Listing', SomeFields);

 

  { You can change the report objects before calling the report }

  areport.page.orientation := poLandscape;

 

  {preview or print the report}

  aReport.Preview;

 

  { all done, free the objects }

  aReport.Free;

  MyTable.Free;

  SomeFields.Free;

end;

------------------

Q.  How can I change the field width and spacing in a report created with QRCreateList?

A.  The width of the fields is calculated by setting the caption of each header to the character 'X', with count coming from the field's DisplayWidth property.  The spacing between each field is set to 10.  If you change the displaywidth property of a field, it will be reflected in the report.

 

To change the spacing, you can either modify the source code or change the spacing in the report after you call QRCreateList.

 

Example:

 

  QRCreateList(aReport, Self, tbCountry, 'Test Listing', SomeFields);

 

  // Now reduce the spacing between each field by 5 (nIdx declared as integer)

  for nIdx := 0 to aReport.Bands.ColumnHeaderBand.ControlCount -1 do

    if aReport.Bands.ColumnHeaderBand.Controls[nIdx] is TQRPrintable then

      with TQRPrintable(aReport.Bands.ColumnHeaderBand.Controls[nIdx]) do

        Left := Left - (5 * nIdx);

 

  for nIdx := 0 to aReport.Bands.DetailBand.ControlCount -1 do

    if aReport.Bands.DetailBand.Controls[nIdx] is TQRPrintable then

      with TQRPrintable(aReport.Bands.DetailBand.Controls[nIdx]) do

        Left := Left - (5 * nIdx);

------------------

 

[Bands]

==================

Q.  My ColumnHeader bands are not printing when there isn't any data for the report

A.  You must have at least one detail band printed to print a column header band.

------------------

Q.  I found this Bug in one of my reports, where the Detailband has the high of two lines and the AutoStretch Label is on the first of this lines. So the Band was expanded, still if there was enough room for a second line.

A.  This is not a bug, it is designed this way.  Our assumption is that if you have extra space below a control, then that space is there for a reason and we expand the band to keep that space.  You could increase the height of the control to cover that space and then the band will not increase until that space is used up.

------------------

Q.  I have a childband and I set it's PrintBand to false based on certain conditions.  When the band doesn't print, QuickReport doesn'check this and will generate a new page is this band would have been the last band on page.

A.  QuickReport checks the space required for the next band before the BeforePrint event of that band is processed.  There is a simple work around that will resolve this issue.  In the BeforePrint event of the previous band (in this case, the detail band), set the height of the child band to 0.  You could store the height of the child band in it's Tag property at the same time.  In the BeforePrint event of the ChildBand, you would set the height back to original height when you have set PrintBand to True.

------------------

Q.  How can I create a report with a Title band to print ABOVE the Page Header band?

A.  The print order of the bands is fixed, you can not print a title band above the page header.  One work around would be to use a child band with the page header.  Put the page header information on the child band and place the title information on the actual page header band.  In the Page Header band's BeforePrint event, set PrintBand to false when the report's PageNumber property is greater than 1.

------------------

Q.  How do I get the column header for to print right above the detail band when I also have a group band?

A.  ColumnBands always printed at the top (aftert the title and pageheader bands).  There are a couple of ways of doing what you are looking for.  You could either put the column labels on the group band or on a child badn attached to the group band.

------------------

Q.  Is there a way to print a band as footer only on the last page of a report.

A.  Instead of using a footer band, use a summary band and set it's AlignToBottom property to true.

------------------

Q.  When my band is split on two pages, how can I keep the non-stretching text controls on the first page?

A.  If you have both stretching and non-stretching components on the same band make sure the non-stretching are printed first (right click and select 'send to back')

------------------

Q.  How do I disable the detail band so that I can calculate in the detail section without printing it?  I just want the summary band to print.

A.  Set PrintBand to false in the band's BeforePrint event.  That will suppress the output of the band, but the expressions will still be calculated.

------------------

Q.  How can I add a child band at runtime and fields to it?

A.  The way to create a child band is to set the HasChild property of the parent to true.  The following code creates a child band and then adds a QRLabel control to the child band

 

  QRGroup1.HasChild := true;

  with TQRLabel(QRGRoup1.ChildBand.AddPrintable(TQRLabel)) do

  begin

    Left := 0;

    Top := 0;

    Caption := 'Hello there';

  end;

------------------

Q.  Is there any possibility to extract the fields embedded in a specific band during run-time?

A.  The bands are descended from TCustomPanel and you can use the ControlCount property to loop through all of the controls on the band.

For example:

 

with PageHeaderBand1 do

  for nIdx := 0 to ControlCount -1 do

    if Controls[nIdx] is TQRLabel then

      TQRLabel(Controls[nIdx]).Caption := IntToStr(nIdx);

------------------

Q.  We trying to use a QRBand in order to create a 'ColumnFooter' but w/o success.  Do you have some tip ?

A.  Quickreport does not have a column footer band.  One way to get a band to print at the bottom of each page would be to use a page footer band and place QRLabels underneath where each column would be.

------------------

Q.        How do I reference the name of a childband created at runtime by setting a band's HasChild property to true?

A.  You must create the Childbands before the report starts.  All QuickReport bands and controls must exist before the report starts.  The easiest way to create a childband is the set the HasChild Property of the parent band to true.  You can reference the child band through through the Parent band's ChildBand property.  The childband will have a blank name property, but you can set that at runtime.  The following example shows how to create a childband, add a label to it, and then get the name of that band:

procedure TfrmReport.FormCreate(Sender: TObject);

var

  MyChild: TQRChildBand;

begin

  QRGroup1.HasChild := true;

  with TQRLabel(QRGRoup1.ChildBand.AddPrintable(TQRLabel)) do

  begin

    Left := 0;

    Top := 0;

    Caption := 'Hello there';

  end;

  MyChild := QRGRoup1.ChildBand.Name;

end;

------------------

Q.  How do I check the height of a band with stretching controls at runtime?

A.  This can not be done with QuickReport 2.0.  The ability to retrieve the height of stretching controls will in the 3.0 release (due out later this year).

------------------

Q.  Is it possible to have 2 or more PageHeader Bands in same Report ?

A.  You can not have multiple PageHeader bands on a report, but there are ways to resolve this.  The simplest way would be to add a child band to the page header and put the fields on the child band that would be used for the 2nd page header.  You would then use the BeforePrint event of the page header and of it's child to decide at run time which band to print.

------------------

Q.  I have a detail band with a child band.  I want to change the number and layout of the controls on the child band at runtime, but I get an exception error when I add new controls while the report is running.

A.  All bands and the controls on the bands must be created before the report starts, otherwise you will get the exception that you reported.

 

There are a couple of ways of doing this.  One way is to have multiple child bands, each one with a different layout to fit your needs.  At run-time, you control which child bands can be output.  Just use the BeforePrint event and set the PrintBand variable to false for the ones that you do not want to print.

 

If you only want one band, put all of the controls on it. and at run time hide the ones that you do not need by setting their Enabled property to false.  To have the controls use the enabled property, you must be using version 2.0j or newer.

------------------

Q.  I have a report that has about 10 child bands that may or may not get printed depending on run time criteria. This report always prints two pages, even if it only needs one to accomodate the childbands allowed at run time. Is there a workaround for this?

A.  In the report's form create event, set each childband's tag property to it's height value and then set the height to 0.  Whenever you set printband to true in the BeforePrint event of a band, set the band's height to the it's tag value.  In the AfterPrint event, set the height back to zero again.

------------------

 

[Barcodes]

==================

Q.  Where can I get a barcode component to use with QuickReport?

A.  We do not provide a barcode control, but on our download page, there are some links to companies who do barcode controls for QuickReport.

------------------

Q.  Where can I find a barcode font that I can use with QuickReport?

A.  There are many companies that have barcode fonts, here are a few of them:

CIA (Bar Codes), Wythenshawe, Manchester, UK   http://ourworld.compuserve.com/homepages/CIA_UK

Rivers Edge, Cedar Park, TX, USA               http://www.riversedge.com

Azalea, Seattle, WA, USA                       http://www.azalea.com

------------------

 

[C++Builder]

==================

Q.  I am trying to write my own Quick Report control using C++Builder 3.0, but I am getting an incorrect value when I try reading the TQRPrinter's FXFactor property?  It evaluates as 1.68100026993337964E-4932 when it should be 1.

A.  A user did some research on this and discovered BCB 3 thinks that variables of the type extended are 12 bytes (instead of 10 bytes) and is shifting the data by two bytes when an extended variable is used in a class.  If you need to use extended variables in Quick Report classes, it may be easier to do that code in Delphi Pascal and just let BCB compile it in.

------------------

Q.  I have a project in which I'm using QR2.0i (standard CB3 package).  I installed Quick Report 3 and recompiled.  The program won't run because of the exception "objectname->Functions.Strings: Property does not exist."  I have not changed the code in any way.

A.  You will need to check your project make files to make sure that you are not pulling in any QR2 header or object files.  The functions property is a property of the TCustomQuickRep class and does not exist in QR2.  You would get this message if you tried to compile a form with a QR3 object but used Qr2 header files.  You will need to replace any refernce to the QR2 package file QRPT35.bpi with QRPT43.bpi.

------------------

Q.  Will my Quick Report professional 2.0i work with new C++Builder 3.0 or I should wait for an upgrade from you?

A.  The current release will not work with it, but C++Builder 3.0 will come with a version of QuickReport 2 that we have compiled for it.  We will post new releases for it after Borland releases 3.0.

------------------

Q.  I am trying to use QuickReport with C++Builder, but your documentation and examples are all Delphi based.

A.  QuickReport is primarily a Delphi product, we do not have the resources to provide the same level of support to the C++Builder users as we can for Delphi users.

------------------

 

[Composite Reports and multiple dataset reporting]

==================

Q.  What are the steps to load reports and preview composite reports.  I add reports to the TList property of QRComposite and then call preview and the preview is empty.

A.  You must add the reports in the TQRCompositeReport's OnAddReports event or they will not be picked up.

Example:

procedure TMainForm.QRCompositeReport1AddReports(Sender: TObject);

begin

  with QRCompositeReport1 do

  begin

    Reports.Add(ListForm.QuickRep);

    Reports.Add(GrpListForm.QuickRep);

    Reports.Add(MDForm.QuickRep);

    Reports.Add(ManyGrpForm.QuickRep);

  end;

end;

------------------

Q.  How can we save a composite report to a file (*.QRP) from sourcecode?  (We can not access a QRPrinter object for Composite Report (seems to be declared 'private')).

A.  You should be able access the qrprinter by referencing the qrprinter of one of the individual reports in the composite report after you call Prepare.

------------------

Q.  Is there a way to set it up so that each individual report making up the composite starts on a new page when that portion goes to print?

A.  To get the second (or 3rd...) report to start on a new page, make sure that 2nd report has a title band and in the title band's BeforePrint event, call the NewPage method of the second report.  If this report is used outside of the composite report, you will need to disable that code.

------------------

Q.  Is there a way to set it up so that each individual report making up the composite starts on a new page when that portion goes to print?

A.  Have a title band with ForceNewPage set to true.

------------------

Q.  Why wasn't the Composite Report fixed in 2.0?

A.  There are problems with TQRCompositeReport that are related to printer settings and header/footer bands. If this isn't important to you please use the component as much as you like. The reason for not publishing the fixes is that they require changes to the interface sections of the units/packages and this breaks package dependencies with Delphi.

You can build a single report that would behave like multiple reports.  The way you would lay it out would be to leave the detail band empty and set PrintIfEmpty to true.  Then add subdetail bands to handle each report.  The master property of each band would be set to the report and they would run one after the other.  You would use each subdetail band as if it was the detail band for the individual report.

------------------

Q.  I wish to create a report which lists the contents of two unrelated tables. How do I do this if you can only have one detail band per report?

A.  Use multiple subdetail bands, one for each table.  Set their Master property to the report.  You don't need a detail band, but you will need to set the PrintIfEmpty property of the report to true.  Each subdetail band can have nested subdetail bands and group header and footer bands.

------------------

Q.  One of the reports in my Composite Report has Landscape Orientation, and the others are Portrait. The report prints everything in Portrait

A.  You can not mix landscape and portrait oriented reports with the composite report.

------------------

Q.  I'm currently using QuickReports for printing static forms without any report functionality. This works fine for me. Then I try to print multiple forms (multiple TQuickReps) as one print job. Therefore I´m using the TQRCompositeReport component but if there are no report components on the TQuickReps nothings happens if you try to print or preview. Is there a way to print different static forms as one print job ?

A.  The CompositeReport control requires that the reports have their controls on report bands.  I was able to print two static reports in a composite report by using a detail band size to fit the page and with the report's PrintIfEmpty set to true.

------------------

Q.  In a report I need just to apply a new filter to the qreport dataset and then continue the report.  It'like running several reports but "bundled" all together in one preview / report.

A.  You can not change the filter on an open dataset, that's a BDE limitation.  One way to do this would be to use multiple subdetail bands for each band.  Each band could use the same dataset.  You would add a group footer band to each dataset.  You would close it, change the filter, and the reopen it in the group footer band of the PREVIOUS dataset.

------------------

 

[Datasets]

==================

Q.  Is it possible to exclude the BDE in any of the 2.x versions of QuickReport as one can do with QR1.1a using the line: {$define XBDE}? If so, which 2.x version?

A.  QuickReport 2 does not have the XBDE compiler directive that was in QuickReport 1. If you are using Delphi 2 or later, this should not be a problem, as the BDE does not get initialized until the first time that it's called.  If you are using Delphi 1, the only alternatives are to either include the BDE or to use QuickReport 1.

------------------

Q.  I am getting the error "Unable to locate source file "quickrpt.pas" and after that EBDEngineError "Table does not support this operator"

A.  There appears to be a bug in the BDE that allows datasets to make a call to the RecordCount property when that value is not supported by all databases.  We have yet to find a satisfactory work around that works for all databases.  You can manually edit the quickrpt unit and comment out the call that causes this exception.  

 

Copy the quickrpt.pas to your project directory.

Look for the line that contains "RecCount := ParentReport.RecordCount;" in the quickrpt unit (the location of the line in the unit will vary depending on which release of QR2 you are usingand comment it out.

Recompile your report (you don't need to add the quickrpt unit to your project, Delphi will find it).

 

Even though there is a try..except block in our code, Delphi is still throwing an exception.  If you modify this code in the quickrpt unit and comment out the code in the if DataSetOK block, you will no longer get that error.

------------------

 

[DLLs and ActiveX]

==================

Q.  Is there any known problems using QR 2.0j in a Delphi 2 (or 3) DLL?  Each time I am finished and make a call to FreeLibrary() from my calling application, the calling application freezes.

A.  There is a known problem unloading a quickreport dll, something is not being freed and that's why your call to FreeLibrary hangs.

The simplest solution is to add QuickRpt and QRprntr (and possibly QRextra) units to the uses clause of the calling app's project source unit. This way the QR dll's are already loaded and the dll will simply increase/decrease the reference count as it is loaded/freed.

------------------

Q.  Where is the ActiveX component that is mentioned on your web page?

A.  We still have some remaining issues to fix with the ActiveX component before we can release it.

------------------

 

[Documentation and help files]

==================

Q.  I like to have the manual loaded, but Word takes up a lot of resources

A.  We have an Adobe Acrobat version of the QuickReport 2 manual available via FTP from ftp://ftp.qusoft.no/pub/quickrep/qr2acro.zip

------------------

Q.  I don't find information on TQRCompositeReport.

A.  Documentation for the TQRCompositeReport will be included in a later release.  There are a few programming issues that still need to be fixed for the Composite Reports and we will release the documentation after they have been resolved. The example demo program included with QuickReport 2 does use the CompositeReport so you can follow that if you wish to work with the CompositeReports before we release the update.

-----------

Q.  I cannot find information about Options Property for TQuickRep

A.  The first options (FirstPageHeader, LastPageFooter) are self describing.  If the FirstPageHeader is set to false, then the pagre header will not be printed on the first page.  LastPageFooter works in a similiar manner  If the Compression property is set to true, then a simple compression routine is used on the internal metafile storage of a rendered report.

Please note that a bug was introduced in Delphi 3.02 that prevents compressed QRP files from being loaded.

------------------

Q.  How does the OnPrint event work?

A.  The OnPrint event is called just before the control is printed. The string to be outputted is in the Value property and can be changed. This property is also useful to suppress printing of repeated values.  This event only gets called at runtime, the design time preview will not call any of the event handlers.

------------------

Q.  How do I install the help files into Delphi 3's integrated help?

A.  1. Copy the file QUICKRPT.HLP  into the HELP directory under the Delphi 3 main directory.

2. Add the line

:Link quickrpt.hlp

to the "Third-Party Help" section at the bottom of the DELPHI3.CFG file  located in the Delphi HELP directory.

3Delete the hidden file Delphi3.GID in the HELP directory.

 

The next time you launch the Delphi 3 help, it will rebuild the delphi3.gid file and the QuickReport help file will be in the integrated help.  Please note that this help file is not complete and will not have support for all controls.  This will addressed in the 3.0 release.

------------------

 

[Exporting reports]

==================

Q.  The output from the export filters does not match the preview's layout.

A.        The export filter layout is a best fit approximation.  You are taking controls that can be arranged anywhere on a band and sending them to a format that is not as flexible.  You can get better results for the filters by changing the layout of the fields and/or their font property.  The report has a boolean property, Exporting, that will be set to true when an export filter is running.  You can add code in the BeforePrint event of the report to check this property if you want to make changes that would only take affect when exporting a report.

------------------

Q.  How do I use the WMF export filter outside of the preview?

A.  The WMF export filter works differently than the other filters.  The other export filters render the report using the filter.  The WMF filter takes the pages rendered to the preview and saves each page as a metafile.  To use this filter outside of the preview, you have to render the report first using Prepare.

Example:

    quickrep1.Prepare;

    quickrep1.qrprinter.ExportToFilter(TQRWMFExportFilter.Create('c:\report'));

    quickrep1.qrprinter.Free;

    quickrep1.qrprinter := nil;

Please note that the file named extension is picked by the Enhanced property to the export filter.  EMF if it's True, WMF if it's false.

------------------

Q.        When I export my report to the TXT export filter, I lose the TQRRichText fields

A.  The TQRRichText, TQRDBRichText, TQRShape, TQRImage, TQRDBImage controls are not supported for the export filters (except for the WMF filter).  One workaround would be to use a TQRDBText control for the RTF data and enable it (and disable the RTF control) when the report's Exported property is set to true.

------------------

Q.  I want to change the layout of the report when it is being saved with export filter, is there a way to determine when a report is being exported?

A.  When an export filter is being used, the report's Exported property will be set to true.  Some of the current export filters have problems lining up columns when the column header's controls have a different alignment than the controls on the detail band.  You can check the Exported property in the report's BeforePrint event and change the appearance of the controls based on that value.

------------------

Q.  PrintPreview & Print work OK until I use ExportToFilter after which PrintPreview & Print do not produce output.

A.  This was a known bug and was address in the 2.0j release

------------------

Q.  When I try to export a previously saved report, nothing happens.

A.  Quickreport can only export reports when they are being generated.

------------------

Q.  How do I get all of the export filters to show in the save dialog in my preview?

A.  Add the qrextra and qrhtml units to your report's uses clause and the filters in those units will show up at runtime.

------------------

Q.  How do I use the HTML export filter?

A.  The export filter topics start at page 98 in the manual, under the topic "ExportFilter".  The HTML filter is an add-on and you will need to add qrextra and qrhtml to your uses clause (and the QuickRep source directory will need to be on your library search path.  You would call the HTML filter like this:

 

QuickRep1.ExportToFilter(TQRHTMLExportFilter.Create('file.htm'));

 

Please note that the HTML filter does not work well and is scheduled to be rewritten in the 2.1 release of QuickReport.  If you need HTML functionality now, you will probably get better results if you use Microsoft's free HTML printer driver (Window 95 only).

------------------

 

[Expressions and user functions]

==================

Q.  I have a report with a TQRGroup,a DetailBand and a GroupFooter band. I want to sum certain values in the GroupFooter for each Group. The problem is that it doesn't sum within the group. It just keeps increasing the values until the end of the report. I don't get the sum for each group.

A.  You will need to set the ResetAfterPrint property to true for the TQRExpr control that you ausing on the GroupFooter.

------------------

Q.  I am trying use the SUM() function inside the IF() function to do a conditional sum, but the control just prints the expression text.  My expression is IF(Table1.PUR_PRICE>40, SUM(Table1.PUR_PRICE), '').

A.  Uou are missing the 3rd paremeter to the IF function and all three parameters are required.  Try using an blank string (''as the 3rd parameter.

------------------

Q.  I would like to sumarize the number of times a non numeric value repeats in a table (without making a new sqlquery like "select count(xxx) where xxx = 'yyy')

A.  You can embed functions in other functions.  You can use the IF() function in the SUM() function to sum the number of times a value appears in the dataset.  The following expression will return the number of records where the state = 'HI',  SUM(IF(Customers.State='HI'10))

------------------

Q.  With the TQRExpr control, the expression -3*4 evaluates to 12 instead of -12

A.  This is bug in QuickReport 2 (fixed in QuickReport 3and the work around would be to use the expression (0-3)*4, which will give the correct value.

------------------

Q.        When I create a report from the Delphi menu (File/New/Report), the QRExpr control does not find all of the datasets on that report.

A.  When the report is not on a form, QRExpr controls will not pick datasets that are connected to the report unless you manually add them at runtime using AllDataSets.  When the report is on a form, QRExpr will find the datasets on that form automaticly.

------------------

Q.  I am using a TQRExpr to print the SUM of a field of a Query.  But I have a problem. If the Query has no result (zero records) then instead of printing the number 0, It is printing SUM(qry.Total).

A.  This is a known problem with QR2 and the work around is to use the OnPrint event of the TQRExpr control to blank out or zero out the value when the value is equal to the expression like the following example:

 

procedure TfrmReport.QRExpr1Print(sender: TObject; var Value: String);

begin

  if sender is TQRExpr then

    if Value = TQRExpr(sender).Expression then

      Value := '0.0';

end;

(QR3) This has been fixed with QuickReport 3

------------------

Q.  When I add lines to a QRExprMemo control at runtime, the control does not filter out any blank lines that may have added.

A.  This control filters out blanklines when the lines are defined before the report starts.  When you add blank lines in the BeforePrint event, we assume that you actually want them in the memo.  The work around is to add code to the BeforePrint event so that you are not adding blank lines at runtime.

------------------

Q.  How do you use the FORMATNUMERIC function, I can't find a help files to help me?

A.  This function is a wrapper for Delphi's FormatFloat() function.

------------------

Q.  Is there an expression that will permit grouping by month? The underlying database has a date field.

A.  You have to pass in an expression that would be the month, the easiest way is to use a calculated database field that would be the year and the month (unless you want the same month from multiple years grouped together.

------------------

Q.  I want to have a database field as the expression, but the table is not available to me at design time and adding <tablename>.<fieldname> to the expression string at run time doesn't work.

A.  To define an expression at runtime, you must define it before the report starts.  Group bands initialize their expression at the start of the report and you can not change the expression while the report is running.  This limitation will be removed in a future release.

------------------

Q.  I couldn't find any information for the meaning of the "arguments" parameter in the RegisterQRFunction

A.  The last parameter is used for the expression builder to know what

    group to put the function in and what parameters to accept.

    First is the group (1-6), followed by one character for each 

    parameter.

 

    1NN would be in the first group (don't remember which one), with two

    numeric arguments.

 

    2SNB would be in the second group, three parameters (text,  numeric

    and boolean

------------------

Q.  Expression wont work if the field name has a space or a hyphen in it

A.  The expression parser will not work with field names with spaces or hyphens in it.  This is a limitation that we try to fix in a future release.  There are a few simple workarounds for this.  One way is to use a TQuery control and rename the field name in the SQL statement.  If you have to use a TTable, create a calculated field based that equals the original.

------------------

Q.  My function doesn'work  I want to use:

if (table1.field1 = '''Blank', table1.field1)

to output the text "blank" when the field is blank or null

A.  Change "if (" to "if(" and the function will work.

------------------

Q.  I can't sum TTimeFields?

A.  TTimefields get converted to strings by the expression evaluator which prevents the report from doing

    math operations on it.  A future release will have a a function to 'convert back' to a float.

------------------

Q.  Expressions are being evaluated from right to left

A.  This will be addressed in a later release. The work around is to use parentheses

------------------

Q.  The following expression always returns 0: SUM(IF(Query1.CartonID='SI', Query1.Caliper, 0))

A.  Change the 0 to 0.0 and the SUM() function will work correctly.

------------------

Q.  Why doesn't the expression Count(Table1.Field1) return the right value?

A.  The Count function in the expression builder returns a number that increments by 1 with every call to Count.  It does not behave like the SQL Count() function that counts the variable passed to the function.  If you click on Count in the expression builder you should see "Increments for each iteration" appear under the Count label as the function's description.

-----------

Q.  How do I check the value of QRExpr control at runtime?

A.  The "Value" property of a TQRExpr comonent is of type TQREvResult, which is defined in qrprntr.pas.  You can check "Value.Kind" to see what the datatype is.  The following table shows how to retrieve the results of the expression based on the value of "Value.Kind"

    If Value.Kind = resInt then the results of the expression are in Value.IntResult

    If Value.Kind = resDouble then the results of the expression are in Value.DblResult

    If Value.Kind = resString then the results of the expression are in Value.StrResult (defined as string[255])

    If Value.Kind = resBool then the results of the expression are in Value.BooResult

    If Value.Kind = resError then the expression had an error

------------------

Q.  I use QRExpr to calculate the Average of a currency field but it shows as numerical, not currency.

A.  This is a known limitation of the QRExpr control.  You can have the control display the currency character by using the mark property and set the mask to something like '$,###.00'.  The QRExpr control's mask is the format string used by FormatFloat() and FormatDateTime functions.  Please refer to their documentation for allowable values.

------------------

Q.  Why does my report crash when I use TQRExpr controls uner Delphi 1?  The same report runs fine when I compile it with Delphi 2.

A.  Delphi 1 uses a lot of stack space when you use nested expressions with the TQRExpr control.  This is why we suggest that you raise the stack size as high as Delphi 1 will let you go for your project.  We allocate all of our expression variables from the heap. but Delphi 1 still uses stack space to handle the multiple function calls required to evaluate the expressions.  With Delphi 1some expressions are bettered handled by adding code to calculate the results instead of using the TQRExp control.

------------------

Q.  I have a simple query that uses the SQL COUNT(*) and I am  trying to display it in a QRExpr component but it is not displaying that field.

A.  The SQL COUNT(*) is conflicting with the QR COUNT function.  You will have to alias the column or use a QRDBText to output the field.

------------------

Q.  I can't get the QRExprMemo to display more than 255 characters when I use Delphi 1.

A.  The number of characters in a QRExprMemo is limited to the maximum string size.  In Delphi 1, the maximum string length is 255 characters.

------------------

Q.  How can I count frequencies of the values in a dataset field?

A.  You can do this with expressions like:

SUM(IF(Table1.GENDER = 'M', 1, 0)) and SUM(IF(Table1.GENDER = 'F', 1, 0))

------------------

Q.  How can I get the dataset of the report to display in the QRExpression if the dataset is on a separate form?

A.  You will need to add the dataset to the report, using the report's AllDataSets property.  The expression will not work at design time, but it will work at runtime.

 

Example:

 

Form1 has a dataset named tbCountry with the field 'Capital' in the table.

Form2 has a report named QuickRep1 with a qrexpr control on the summary band.

 

You want qrexpr to read the capital field of the tbCountry dataset.

 

You would have form2 use form1 and in the report's BeforePrint event you would add the tbcountry table to the report with the following syntax:

 

procedure TForm2.QuickRep1BeforePrint(Sender: TQuickRep;

  var PrintReport: Boolean);

begin

  with quickrep1.AllDataSets do

    if IndexOf(Form1.tbCountry) = -1 then

      Add(Form1.tbCountry);

end;

 

The QRExpr.Expression property would be set to tbcountry.capital

------------------

Q.  I want to sum a field, but I need to ignore the highest and lowest value, can this be done?

A.  You can do this by using the expression 'SUM(Field)-MIN(Field)-MAX(Field'.  Please note that if you only have two records, the sum will be zero.

------------------

Q.  What are the allowable datatypes that can be used in a TQRExpr control?

A.  The allowable Delphi datatypes that can used in a TQRExpr control (or Group expression) are longint, double, string[255], and boolean.  Currency fields are stored as double.  Date and time fields are stored as string.

------------------

 

[Frames]

==================

Q.  How can I separate the letters from the top of the frames with a QRDBText control?

A.  The current release provides no control over the relative positioning of the frame in regards to the text.  You can get finer control by using a QRShape control and place it underneath the text control.

------------------

Q.  Settimg DrawBottom to true of the report's Frame property of works on preview, not when printed.

A.  The default bottom margin of a report goes beyond the printable area of many printers.  If you set the bottom margin to a greater value (try 1.0 in as an example), you should see the bottom frame.

------------------

Q.  Some lines do not appear in the preview, but they appear in the printout.

A.  The report is rendered to a TMetafile object when it is sent to the preview.  Depending on the zoom value of the preview, the scaling of the TMetafile may crop out some of the lines.  If you zoom in (you may need to use a custom preview to zoom in close enough), the lines will reappear. 

------------------

 

[Groups]

==================

Q.  How do I print a group footer band?

A.  Add a TQRBand, set it's type to groupfooter and link to rbGroupFooter.  You would then link it to TQRGroup band by the footerband property.  The new band will print at the end of the group of detail band.

------------------

Q.  Is there an expression that will permit grouping by month? The underlying database has a date field.

A.  You have to pass in an expression that would be the month, the easiest way is to use a calulated database field that would be the year and the month (unless you want the same month from multiple years grouped together.

------------------

Q.  I have a billing report. In the group-footer I take the sum of the amounts. I print it at the summary . Now I would like to print the intermediate-results of the amounts at the end of each page (except at the end of the last page). How can I do it?

A.  You would put the TQRExpr component to handle the amounts on a page footer band.  Set the QRExpr's ResetAfterPrint to true so that the total will get reset after each page.  To suppress the final page footer, set the report's Options.LastPageFooter to true.

 

If you want to have a page footer on the last page, but want to suppress the output of the last page's total, one easy way to tell that you are on the last page is to use a summary band.  It will be called before the last page footer and you can use it's BeforePrint event to set a flag to prevent the output of the final QRExpr total.  If you don't need a summary band, set it's height to 0.

------------------

Q.  When I have a group header for a sub-detail band, the header gets printed twice for the first record and only once for every record thereafter.

A.  If you just want a group header band to print for each set of subdetails, do not use a TQRGroupband, that band is for when you want to break up the data in groups.  Just set the subdetail band's Bands.HasHeader to true.  This will add a band of type TQRBand and it will only print at the start of each set of subdetails.  This is documented on page 5-73 of the manual under the topic "BANDS PROPERTY FOR TQRSUBDETAIL".

------------------

Q.  TQRGroup does not work with an expression on a queryfield if the query component is not on the report form. 

A.  The dataset must be either on the form or on the report's datamodule.

------------------

Q.  A new page is not generated on the GROUPHEADER if the current page number is 1 (one) and the Property NewPage is TRUE.  It will work fine if this occurs on page number 2 or higher.

A.  QuickReport was designed to ignore the first ForceNewPage band if that band is on the first page.  To get around this, set ForceNewPage back to false and call the report's NewPage method from the BeforePrint event of that band like the following:

procedure TfrmGroupTest.QRGroup1BeforePrint(Sender: TQRCustomBand;

  var PrintBand: Boolean);

begin

  Quickrep1.NewPage;

end;

------------------

Q.  How do I do set a group expression to break on multiple fields?

A.  Set your group band expression to 'Query1.Field1 + Query1.Field2'if they are strings.  If they are not strings, convert them to strings first using the STR() function.

------------------

Q.  We query our data grouped by a field and is there any neat way to get the text "to be continued" to the bottom of the page if the group is several pages, i.e. how do we know before page change the last row was not the last record in the group?

A.  There isn't a "neat" way to do this with the current version.  You may want to add with some code to the BeforePrint event of the page footer band.  You could check the next row in your dataset to see if the group changes.  Just remember to leave yourself in the original row of the dataset so that you don't skip any rows.

------------------

Q.  How do I get group headers to print after a page break?

A.  The ability to do this automaticly will be in the 2.1 release (due out later this year).  You can emulate repeating group headers through code and some duplicate bands. An example program that shows how to do this can be downloaded from our web site.  Look for the file "repeats.zip".

------------------

Q.  How do I create a group band at runtime?

A.  Before the report starts, you can add a group by creating a control of that type and setting some of it's properties.  The following code would add a group band to a report using the orders table

 

procedure TfrmCreateControls.FormCreate(Sender: TObject);

begin

  { Create the group on this form }

  QRGroup1 := TQRGroup.Create(Self); { QRGroup1 defined as TQRGroup in the form declarations}

 

  with QRGroup1 do

  begin

    { assign it to this report }

    Parent := QuickRep1;

 

 { assign it to the detail band }

    Master := Parent;

 

 { Set it's expression }

    Expression := 'CustNo';

  end;

 

  { Now add a text control to this band }

  with TQRDBText.Create(Self) do

  begin

    Parent := QRGroup1;

    Dataset := QuickRep1.Dataset;

    DataField := 'CustNo';

  end;

end;

------------------

Q.  I have several Group Bands in my report. How is it possible to change the printing order of these bands at runtime. Eg. at case one I need to print only Group1, case two Group2, Group 1Group 3, case three Group 4Group 2 etc. The order is told by enduser at runtime. 

A.  QuickReport uses the creation order of the group bands to set the order at runtime.  You can change the ordering of the group bands by calling the their SendToFront and SendToBack methods.

------------------

 

 

[Images and Shapes]

==================

Q.  How I do to make background shadow in alternated lines (detail) of report?

A.  Place a TQRShape underneath all of the other controls on the band.  Make sure the transparent property of the text controls on top of the shape is set to true.   In the BeforePrint event of the Band, "toggle" the Brush.Color of the TQRShape.  This will not appear at design time, but will work at runtime. Example:

procedure TfrmMasterDetail.QRSubDetailItemsBeforePrint(

  Sender: TQRCustomBand; var PrintBand: Boolean);

begin

  { toggle the item background so that we can have alternating colors }

  { like the greenbar paper we all know and love.                                          }

  with QRShape1.Brush do

    if Color = $00F0F0F0 then

      Color := $00E0E0E0

    else

      Color := $00F0F0F0;

end;

 

This will allow you have a color that does not use up the entire width of the band.  If you want to do the entire band, set the band's color property and leave out the TQRShape.

------------------

Q.  Is there a 3rd party component vendor for QR that supports PNG images?

A.  I don't know of any PNG controls for QR2.  Delphi 3's Image control can be extended to support other formats, if a vendor has provided a package that adds PNG to the standard Delphi 3 TImage control, it should work in Quickreport 2.

------------------

Q.  (Delphi 3) I am trying to use the QRImage component to print a jpg image. I noticed that if I select a jpg image after placing a qrimage component on a quickreport, it shows up correctly on screen. But when I then PREVIEW the report, the image is not there.

A.  Did you add jpeg to your uses clause for that report?

------------------

Q.  Why wont QRImage doesn't print icon files when Stretch is set to true?

A.  The Stretch property has no affect on icons.  This is documented in Delphi's help for the stretch property of TImage (ancestor of QRImage)

------------------

Q.  My shapes don't print correctly on bands that wrap over a page

A.  Right click on QRShape and select print to back so that it get printed first

------------------

Q.  Why do TQRShapes appear thicker on screen than when it prints

A.  There is a known problem where the thickness of the Shape's lines vary between the preview and the printer.  The work around is to set the Shape.Pen.Width property to a variable and set the value dpending on whether you are printing or previewing.  In the report's BeforePrint event, you can check the value of the report's QRPrinter.Destination property.  If it'set to qrdMetafile, then it's rendering the preview.  If it'set to qrdPrinter, then it's rendering the report directly to the printer.

------------------

Q.  I'm creating a report which requires a couple of vertical lines on the page.  I have added the appropriate QRShapes (shape=qrsVertLine) to the detail band.  How do I continue the vertical line on the page even when there are not enough detail records to fill the page?

A.  Try dropping a TQRShape directly on the report control (not on a band), and set it's height to fit the printable area of the page.  If you use "Send to back" on the shape, the bands will appear on top of it.  This will give you a continous shape going down the page.  You may need to add code in the report's BeforePrint event to set the Size.height of the QRShape to the height of the report minus the top and bottom margins.

 

Note:  This will not work with Composite Reports.

------------------

 

[Installing & converting from previous versions]

==================

Q.  I can't install Quick Report 3, it conflicts with WPTools (or any package that uses Quick Report_.

A.  If you compiled your WPTools package to use Quick Report 2, you will need recompile it for Quick Report 3.

1. Remove WPTools from the package list.  You must completely remove the package from the list, disabling it is not enough.

2. Install Quick Report 3

3. Locate and open the package file (.dpk) for the WPTools.  The name and location of the file will vary depending on which version you installed and which version of Delphi is used.  Look for any reference to qrpt30 in the requires list.  This is the Quick Report 2 file.  Remove it and recompile the package.  It should find the Quick Report 3 filer, qrpt40 (qprt43 for Delphi 3).  If it doesn't find it or tries to use qrpt30, you will need to manually edit that line.

4. Rebuild the package.

------------------

Q.  My custom preview doesn't work the way it did with QR1

A.  The preview must be called with Show instead of ShowModal.  This a change from the QuickReport 1 behavior, but is required for QuickReport 2.

------------------

Q.  In D2 and QR 1.1 I used "TQRCustomControl" how can I get it to work in D3 and QR2.0 ?

A.  This was replaced in QuickReport 2 by the TQRPrintable class.  This is documented in the manual.  The example control detailed in the manual had a couple of bugs, a better example control can be downloaded from our web page under the name "qrcb.zip".

------------------

Q.  We have just installed QR20K instead of QR20Kbeta (working with D3 +Language Pack).  We now notice that the Quick Report Units are not translated into Dutch as it used to be with QR20Kbeta.

A.  You will need to uninstall and then re-install the Language Pack.

------------------

Q.  I am porting a report from QR1 to QR2 and the FromPage and ToPage properties are missing.

A.  In QuickReport 2 they are named FirstPage and LastPage.

------------------

Q.  I keep getting the error: "Can't load package (the path & such)" A device attached to the system is not functioning"

A.  Delete the file qrpt30.dpl from the delphi 3.0\bin directory.

------------------

Q.  Recently I upgraded Delphi 3 to Delphi 3.02.  I now get an error trying to install QRPro package.   

Error Message comes back as: Can't load package c:\quickrep\delphi3\bin\dclqpro.dpl.  A device attached to the system is not functioning.

A.  When upgrading Delphi 3 to the new release, you must reinstall QuickReport 2 and follow all of the original instructions.  This error is happening because you did not delete all copies of qrpt30.dpl from your system BEFORE installing QR Pro.

------------------

Q.  I recently received the latest copy of Delphi v3, build number 5.83. Whenever I load Delphi, an error message appears:

    PROCEDURE ENTRY POINT QREXTRA.TQREDITOR AT 7DBEC950 COULD NOT

    BE LOCATED IN DYNAMIC LINK LIBRARY QRPT30.DPL

A.  The Delphi 3.01 maintenance release comes with the standard version of QuickReport 2.0g and it does not come with the QREditor component.  You will need to reinstall your current QuickReport Pro over the one that comes with Delphi 3.01.

------------------

Q.  I am trying to convert a Report from version 1.x to 2.0i, in Delphi 3.  In version 1.x it was possible to have several detailbands in the same report, and then enabling the detailbands as they where needed, thus having different bands visible, depending on a field in the dataset.

A.  QuickReport 2 does not support multiple detail, page header, or title bands, but each band can have a child band and you can control the output of each band individually at runtime.  Please see the manual topics on ChildBands for more information.

------------------

Q.  The TQRGroup property GroupData was in Version 1 does not exist in QuickReport 2.  Is there a replacement?

A.  The QuickReport 2 does not have a groupdata property, it has an expression property for determining group breaks.  Setting this property is documented on page 2-41 of the manual.

------------------

Q.  [Delphi 3] How can I restore a german layout during runtime in the Preview ?

A.  The German resource files supplied with Delphi 3 does not work with current release of QuickReport Pro.  We will post a revised German resource file as we can get it updated.

------------------

Q.  I updated to QuickReport 2 with C++ Builder and I can't compile my existing QR1 reports.

A.  In addition to following Appendix C in the manual, C++ Builder users will have to remove the following line from their source code:

#include <vcl\QuickRep.hpp>

This file is part of QuickReport 1 and will cause conflicts when compiling with QuickReport 2

------------------

Q.  The QRGroup in version 1.0 had a field called DataField, in the 2.0 version this field doesn't exist. In the unit that called the report I would set the contents of this field. How do I do it now?

A.  The QuickReport 2 QRGroup has an expression field that works like the expression property of a QRExpr component.  This is documented on page 5-102 of the manual.

------------------

Q.  I cannot run the QuickReport demo programs in Delphi 1.

A.  We apologize for that, but that error will not stop Delphi 1 from compiling the QR2demo.  If you select "Ignore All" when errors pops up when loading a form, the project will run under Delphi 1.  Just load each form and save it back out again.  The errors will only appear once.

------------------

Q.  I could not find the Linkband feature that QR1 has.

A.  This is scheduled for the 2.1 release.

------------------

Q.  When compiling and starting the qr2demo.dpr the following error occurs: Error while reading GrpListForm.Font.Charset. Property does not exist !

A.  The version of Delphi that you used did not support that property, you should be able to load the form by selecting "Ignore All" on the error dialog.

------------------

Q.  Will reports written in 2.0 be compatible with 2.1?

A.  Yes,  2.0 will be upwardly compatible with 2.1, and 2.1 (and 2.0) reports will be upwardly compatible with 3.0

------------------

Q.  In QR1, we had ShowDialog Property to Show PrintSetup Dialog before Print, but in QR2 does not have this. How can I do this function?

A.  If you call the Report's PrinterSetup method, this will set the printer settings for the report before you run it.  You could do it like:

 

  with frmReport do

  begin

    QuickRep1.PrinterSetup;

    QuickRep1.Preview;

  end;

------------------

Q.  I installed QuickReport Professional version 2.0 in my Delphi 3.0all went well and the two new components were installed. When I try to run the example project for the QREditor Component, EDITOR.DPR, I get a error message in line 41 of the QREDFOR unit that says: Undeclared identifier: TQREditor.

A.  Please make sure that you have enabled the dclqlpro.dpl package under project options.  This package is labeled "Delphi QuickReport Professional Components" and it should be in your "...\Delphi 3\bin" directory.

------------------

Q.  I just installed QuickReport 2 Pro, but I can't find the editor component

A.  This control gets installed when you install QuickReport, it's usually one of the rightmost components on the qreport pallet.

------------------

Q.  After I install QuickReport Pro into Delphi 3, I only see the QREditor and QExprMemo components

A.  Make sure that you have selected the dclqrt30.dpl package

------------------

Q.        My QuickReport right-click menus have blank lines (German release of Delphi 3)

A.  In the "bin" directory of delphi, delete the file "dclqrt30.DE".  In the windows system directory and in delphi 3.0\bin, delete "qrpt30.DE"

Borland is using "FR" extension for the French release. So you need to delete all copies of "dclqrt30.FR" and "qrpt30.FR" before installing QR2 Professional.

------------------

Q.  I keep getting CGI timeouts when I try to download from your web site.

A.  We have had some technical difficulties on our server and with our ISP.  If you get an error, please

    again later.

------------------

Q.  I have upgraded to version 2.0 from 1.1. Since then I can't load an already saved report.

A.  The saved reports from QuickReport 1 are not compatible with QuickReport 2

------------------

Q.  What happened to the thumbnail feature of QR1?

A.  Thumbnails are not supported in QuickReport 2.0, it will be back in version 3.0 later this year.

------------------

Q.  I tried to download qreg20g.exe from your website but I get the 'Document contains no data' message.

A.  The maximum number of users that can access our web site may have been reached.  Please wait a few minutes and try again.

------------------

Q.  Every time I try to download the new release of QR, I  receive the message: Impossible to open http://www.qusoft.no/scripts/filelist/filelist.exe?DL. 

A.  What program are you using to download QuickReport?  If you are using Microsoft Internet Explorer 4.0, we have received reports that this program can not download from many web sites, including our own.  MS IE 3.0x and Netscape have no problems downloading from our site.

------------------

Q.  How can I tell which version of QuickReport is installed in Delphi?

A.  When you right-click on the QuickReport component, the version is displayed as the first line of the pop-up menu.

------------------

Q.  But what is that TQRExprMemo? I can't find this component....

A.  This component is in the qrbonus unit.  You'll need to install that unit to get that control.

------------------

Q.  I have removed QR from the package list but how do I reregister it?

A.  That means that you will need to add that package back into Delphi 3.  

Select Component->Install Packages

Press the Add button in the "Design packages" panel.

Select the bin directory in your Delphi 3 directory

Select the dclqrt30.dpl and press the Open button

Repeat for the dclqrpro.dpl package.

Finally, press "OK" in the "Project Options" window.

 

If this does not work, I would try reinstalling the QuickReport all over again, making sure that you follow the instructions in the readme file without missing a step.

------------------

 

[Master/Detail reports]

==================

Q.  I would like to know if it is possible to include subreports into reports like Microsoft Access.

A.  QuickReport 2 has a simliar feature with the TQRSubDetail band.  This is documented in the manual and in the kb.zip file on our download page.  A Master/detail tutorial project is available on our download page.

------------------

Q.  How do I insert a new QRsubdetail band in between two existing subdetail bands? I have a very long report and when I insert a new band at the end and use the "move band up" option on the pop-up menu, it seems to really mess the report up.

A.  QuickReport uses the creation order of the group bands to set the order at runtime.  You can change the ordering of the group bands by calling the their SendToFront and SendToBack methods.

------------------

Q.  How do I create a QRSubDetail band at runtime?

A.  The following code creates a subdetail band and adds a QRDBText control to it:

  SubBand := TQRSubDetail.Create(self);

  MyText := TQRDBText.Create(self);

  with SubBand do

  begin

    Height := 20;

    Parent := QuickRep1;

    Master := QuickRep1;

    Dataset := tbOrders;

  end;

  with MyText do

  begin

    Top := 0;

    Left := 10;

    Parent := SubBand;

    Height := 17;

    Dataset := tbOrders;

    DataField := 'OrderNo';

  end;

------------------

Q.  I could not get the SUM() expression to work on subdetail bands.

A.  Make sure that you have Master property of the QRExpr control set to the SubDetail band.

------------------

Q.  I have a two level report where I on the primary level tries to cancel the output for both levels by setting the printband property to false for some of the primary records. Why is the secondary level printed anyway? How can I avoid this?

A.  The PrintBand feature was designed to work independant of any other band.  In thsi case, one work around would be to set the detail band's tag property to 1 when print and 0 when you do not print.  When you get to the subdetail, set it's PrintBand to true only when the detailband's tag property is greater than 0

------------------

Q.  I want to make a report with 2 subdetails. The first subdetail works fine, but the second I need that it has 2 or 3 columns but I don't know how can I make that a subdetail can have 3 columns and the other sections has only one column.

A.  You can not do this with QuickReport at this time.  The number of colums applies to all detail and subdetail bands.  One work around is to put three sets of TQRLabels on your second subdetail band and manually handle the columns.  In the BeforePrint event of the band, you would populate the first set of QRLabels.  You would then call the dataset's Next method (if not EOF) and populate the 2nd set of QRLabels. If not EOF, you would  do one more time for the 3rd set of labels.

------------------

 

[Misc]

==================

Q.  I am trying to use the new Euro character.  It shows up in the preview, but it prints as a block

A.        Your printer driver may need to be updated.  Microsoft has detailed information on this at http://www.microsoft.com/windows/euro.asp

------------------

Q.  I am writing my own control for QuickReport, how I do convert my units so that control is the correct size for the preview and the printout?

A.  You would use the qrprinter's XPos() and YPos() functions to convert absolute measurements in 0.1mm units to the actual device coordinates.  In the TQRShape.Print method in qrctrls.pas, there are a few examples of how we use XPos() and YPos() to handle the scaling for the drawing of shapes.

------------------

Q.  I printing the report in duplex and I want every other page to only print some static text.

A.  One way to do this would be to use a ColumnHeader band and use the BeforePrint and AfterPrint events of that band to control the printing.  If you are currently using a ColumnHeader band, add a child band to the ColumnHeader and move your existing Column Header controsl to the child band.

 

In the BeforePrint event of the band, set it so it only prints on even numbered pages.

 

Example:

procedure TfrmMDDuplex.ColumnHeaderBand1BeforePrint(Sender: TQRCustomBand;

  var PrintBand: Boolean);

begin

  // Print only on the even pages

  PrintBand := (QuickRep1.PageNumber > 1) and ((QuickRep1.PageNumber mod 2) = 0);

end;

 

In the AfterPrint event, force a new page when the column hedaer band has been printed.

 

Example:

procedure TfrmMDDuplex.ColumnHeaderBand1AfterPrint(Sender: TQRCustomBand;

  BandPrinted: Boolean);

begin

  // If we printed the band, force a new page

  if BandPrinted then QuickRep1.NewPage;

end;

------------------

Q.  I am tring to reset the page number for every group band.  How can I do that ?

A.  This is not supported by the QRSysData control.  You will have to track the page number manually and assign the value to a TQRLabel.

------------------

Q.  Does quickreports support BDE alternatives such as ODBC98?

A.  As long as the 3rd party package supplies a descendant TDataset control it should work.  I use OBDCExpress and their TOEDataset control works just fine with QuickReport 2 and 3.  The general rule of thumb is that if the regular Delphi dataware controls work with your 3rd party TDataset, then QuickReport will work too.  The release of QR3 bundled with Delphi 4 would not work with non thread safe database drivers (like SQL Links or Opus), but this was addressed in the 3.0.1 release.

------------------

Q.  My report uses tables on a datamodule and even when my report form is using the datamodule, I can't get the tables or fields to show up.

A.  Make sure that the datamodule is loaded when you are setting the fields at designtime.

------------------

Q.  I use the following procedure to create forms at run time:

procedure TfmMainForm.ShowModalForm(FormClass: TFormClass);

begin

  Screen.Cursor := crHourGlass;

  with FormClass.Create(Application) do

  try

    ShowModal;

  finally

    Free;

  end;

  Screen.Cursor := crDefault;

end;

Usage: ShowModalForm(TfmSpecialForm), ShowModalForm(TfmOtherForm);

 

I need a similar routine to create reports.

A.  The FormClass is specific to forms and you can not do the same thing with the report class.  Put the report on the form and use the form's FormShow event to call the report's preview.

------------------

Q.  Is there a way to reset the page number based on a group header?  This would be useful when printing invoices.

A.  Instead of using a TQRSysdata control, use a TQRLabel and manually track the page number.  You can increment and reset that value in your code based on the events that you select.  Then in the footer band, set that TQRLabel's Caption to the string value of the page number.

------------------

Q.  Is it possible, to use the MS Intellimouse's wheel inside the preview of quickreport?

A.  This should be handled by the OS or by the mouse driver.  With Win98, the mouse wheel support is in the OS, with Win95 you can enable the wheel with the Intellimouse 2.2 driver from MS.  I have tested the preview with Intellimouse 2.2 under Win95 and the preview could be scrolled by the wheel.

------------------

Q.  What's the difference between this file and QR2FAQ?

A.  QR2FAQ was intended to list the current release notes along with some common questions.  This file is basicly the most common questions (and some uncommon ones) that the users have sent in.

------------------

Q.  When I set the height of the report, it keeps going back to the default value, is this a bug?

A.  The height value of the report is derived from the page size.  If you manually set this value, it will snap back to the calculated value.

------------------

Q.  It is difficult to manage reports with many bands. Is there a better way to create complex reports ?

A.  When I have a single report with many bands, I set the height property of the bands that I am not working on to a small value to shrink them out of the way at design time.  I assign the actual height to the band's tag property and at runtime, I just copy the tag to the height property to expand the band back out.

------------------

Q.  I want to print reports with text and pictures. Each of the pictures (two in a row) shall have a caption. Now it sometimes happens that the caption is printed on the first page, but the pictures on the next page. How can I keep that together?

A.  Right-click on the image controls and select "send to back".  This put the images at the top of the creation order on the band and they will be printed first, forcing a page break if needed.

------------------

Q.  I want a 1.5" top margin and 0.5" bottom margin on odd numbered  pages and a 0.5" top margin and 1.5" bottom margin on even pages.

A.  You can't change the margins while the report is running.  One work around would be use childbands on the page header and page footer bands and selectively print the childbands on every other page.  First set the top and bottom margins to 0.5".

 

For the footer band, you add a blank child band of 1" in height.  In that band's BeforePrint event, you would set PrintBand to true only on even numbered pages.  This will give the appearance of increasing the bottom margin by 1on the even number pages.

 

For the Headerband, you would do almost the same thing.  You add a child band and move all of the header information from the actual page header band to the childband.  You then set the height of the pageheader band to 1and in it's BeforePrint event, you would set PrintBand to true only on odd numbered pages.  This will give the appearance of increasing the top margin by 1" on the odd number pages.

------------------

Q.  How can I set the contents of the page header based on the first subdetail band that prints on that page?

A.  You could do this by using childbands on the page header.  Use group footer bands (if you don't actually need one, set their height to 0 before the report starts) and in the BeforePrint event of the group footer, set a global variable to a value that would represent the next subdetail band.  When the it comes time to output the child bands on the pageheader, you would set their PrintBand variable in their BeforePrint event based on the value of that global variable.  Since the variable is being updated when a subdetail is finished, if you hit the page header that means that there is more data.  You would not want to increment the value by 1 each time, that would get out of synch when a subdetail band did not have any data.  Remember to initialize the global variable in the report's BeforePrint event.

------------------

Q.  All of my fields come out blank.

A.  Did you set the dataset property of the report to an active dataset?

------------------

Q.  An error appears when we set the "Orientation" in the "Page" property to "poLandscape" and the "PaperSize" property to "Default". If we now call the Preview, the following error message appears on the screen : "Error on floatingpoint operation".

A.  There is a known problem with QR2 if you change the orientation at runtime when the paper size is set to Default or Custom.  This wil be addressed in a future release.  One work around would be to use the following code:

 

with QuickRep1 do

begin

  {Get the current papersize from the default printer and set the report to use it}

  with TQRPrinter.Create do

  begin

    Printerindex := -1;

    QuickRep1.Page.PaperSize := PaperSize;

    Free;

  end;

  Page.Orientation := poLandscape;

 

  Preview;

end;

------------------

Q.  When I use the Apollo driver to access a Foxpro table and I can not preview reports that use QRDBText controls with MEMO fields.

A.  It has been reported to use that if you have the Apollo driver configured so that the BDE can also be used, you can get this problem. Setting the Apollo driver so that it's the only driver has been reported to fix this problem.

------------------

Q.  Everytime I preview a report, I lose memory.

A.  There are a few things things that could cause this.  Older versions of QuickReport did have some memory leaks, you should be using version 2.0J or newer.  If you are using a custom preview, make sure that you are freeing the form in the preview form's OnClose event.  If you set the close action to caFree, the form will not be actually freed until the application has terminated.

We have had many reports of cumulative memory losses when using HP Deskjet drivers.  This is a problem with the printer driver, not with Quick Report. If you are using one of these drivers, you should get the latest driver for your printer from HP's web site (http://www.hp.com/cposupport/jsnav/prhome.html).  Switching the printer driver to another printer (make sure it's a very different kind of printer) is an easy to test if your printer driver is causing the problem.

------------------

Q.  I have two forms, Form1 contains a TTable, Form2 contains a TQuickRep. Form2 includes Form1 in its uses clause. I place a TQRExpr on the report, and open up the Expression property editor by clicking ellipsis. The table in Form1 cannot be viewed/selected in this editor.

A.  You will need to use the report's AllDataSets property to add datasets from other forms.  This is documented in the manual under the "AllDatatSets" topic.  Please note that you should use the AllDataSets's Add method in the report's BeforePrint event.

------------------

Q.  Is there any way to perform "Hide Duplicates" for some repeated data item in a report?

A.  You would have to store the previous field value in a variable and compare the current field against it.  You would reset the variable in the report's BeforePrint event and compare the variable against the current dataset field in the control's OnPrint event.

 

Example:

  LastVar is defined as string the form's public section

 

procedure TfrmSub2.QuickRep1BeforePrint(Sender: TQuickRep;

  var PrintReport: Boolean);

begin

  { Clear our variable }

  LastVar := '';

end;

 

procedure TfrmSub2.QRDBText5Print(sender: TObject; var Value: string);

begin

  {

  If this field is same as the last one, then we clear it. If it's new

    we set our variable to that field and let this one print

  }

  if Value = LastVar then

    Value := ''

  else

    LastVar := Value;

end;

------------------

Q.  Using QR2 and trying to call addprintable in the beforeprint event of a band causes a GPF (or an Access Violation). Is this not allowed for some reason?

A.  You can only call AddPrintable or otherwise add a control to a report band before you start the report.  QuickReport needs to know about all printable controls before it starts the report.

------------------

Q. If I print a invoice with two lines at the botton of a page, I have this problem. The  pagefooter is necessary because the lines of Subdetail prints at bottom of the page. The first page is Ok. On the second page, the last page of invoice, in GroupfooterBand1Beforeprint I have

 QRFooterband.enabled := false;

 QuickRep1.ResetPageFooterSize ;

The pagefooter doesn't print, but Groupfooterband does not align to bottom.

A.  If you call this code from the group footer's BeforePrint event, it is too late, it's print position has already been set.  What will work is if you that code in the PageHeader's BeforePrint event.  If you are not using a PageHeader band, add an empty one to do this code and then set PrintBand to false to suppress the output of the PageHeader.

------------------

Q.  Why does QuickReport change my detailband's Size.Height property from 33.0 to 33.07 after I preview a report?

A.  Try setting the report's SnapToGrid property to false, that should keep the band from resizing.  The Delphi IDE will also round certain values, if you set the value to a slightly smaller value, it should round up to the correct value.  If the rounding error is really throwing your report off, you can always set the value at runtime and it will not get rounded.

------------------

Q.  How can I convert from pixels to the measurement unit used by the QRPrinter object to be able to print to the screen or printer?

A.  QRPrinter.XSize(aNumber * ParentReport.TextWidth(Font,'W')) should do the trick.

------------------

Q.  My shapes print out thinner than they appear in the preview

A.  This is a known issue that we are researching.  A user sent in the following work around: I can get the thick line by changing then shape to qrsrectangle with a width of 2 and change the brush color to clblack.

------------------

Q.  In my report I want to print a blank line every between every 5 lines with data, to make it easier to read. How can I do that?

A.  On every 5th record, double the height of the detail band in the BeforePrint event. In the AfterPrint event, reset it back to normal.

------------------

Q.  How can I make a row wider than 1 page. 

A.  This is not currently supported.  One alternative would be to use multiple subdetail bands and run through the data set a couple of times, for each set of columns.  Let say that you have 20 columns and only 10 will fit on the width of a page.  Leave out the detail band and set PrintIfEmpty to true.  Set each subdetail band to the same dataset and put different columns each.  Each subdetail will print all of the records but with different columns.  You will need to call the dataset's first method after each subdetail set has been executed.

------------------

Q.  Can you tell me how I can view the non-continuous rows in a DBGRid by using QuickReport? I set dgMultiSelect from TDBGrid to True, and I select some records in non-continuous order, then ...?

A.  You'll need to use the QuickReport OnNeedData event (it's in the manual) to pull data from a DBGrid.  In the OnNeedData event, try the following code:

MoreData := DBGrid.SelectedRows.CurrentRowSelected; 

 

Another method would be populuate a temporary table with the selected rows and have the report work with the temporary table.

------------------

Q.  How can I put a blank page in front of a report.

A.  Put a blank title band on the report and call the report's NewPage method in the title band's AfterPrint event.

------------------

Q.  How do I print a text file as a report?

A.  There are several ways to do this.  The qrprntr example project in the \quickrep\demos\qrprntr directory pritns a text file using the TQRPrintJob class.  You could use a single detailband and read the text file into a QRMemo, just make sure to set PrintIfEmpty to true.  Or you could use the OnNeedData event and read the file line by line and set a qrlabel.caption on the detail band to the current line.

------------------

Q.  How do I change the Delphi help file to be able to search in the new QuickReport Help?

A.  You need to use Borland's Help file installer (helpinst.exe) add 3rd party help files (such as QuSoft's) to your system.  Please see your Delphi documentation for information on the usage of the Help file installer

------------------

Q.  I am having trouble with the QRChart control.

A.  This control is a QuickReport compatible component written by Tee-Mach.  Please contact them at http://www.teemach.com/ for all QRCHart support questions.

------------------

Q.  I'having trouble placing controls at precise locations when the I have the report set to 50% zoom

A.  You should keep the zoom value at 100% when adding controls to a form, otherwise you will not be able to have precise control over the placement of the controls.

------------------

Q.  What is the difference between the global QRPrinter, the preview's qrprinter, and the report's, qrprinter?

A.  Each report has it's own QRPrinter object.  There is a global QRPrinter object that can be used outside of the QuickRep object.  Each QRPrinter is a distinct object.

The Preview's QRPrinter object is just a pointer to the QRPrinter of the report using that preview.  When you reference the preview's qrprinter, you actually referencing the qrprinter object of the report currently being previewed.

------------------

Q.  How do I print out text rotated at an angle?

A.  BitSoft Development, L.L.C, has shareware control called QrRotateLabel and you can download it from http://www.bitsoft.com

Another control can be found on the Delphi Super Page (http://sunsite.icm.edu.pl/delphi/)

------------------

Q.  How can I to begin a report (QR) with current record and then continue from that record?

A.  QuickReport starts with the first record of the dataset, you will need to have the dataset return a set of records starting with the one that you want to start with.  If using the TQuery, use the WHERE clause of it's SQL property to specify the starting record.  With TTable, you can use it's filter properties (Delphi 2 or higher).

Another way would be to use the OnNeedData event to navigate through the dataset, this would work, but would require more code than limiting the dataset through their own properties

 

QuickReport 2 really doesn't have a direct way of filtering by record count.  One thing that you could do is to use the BeforePrint event of the detail band and set the PrintBand boolean to true for the records that you want to print.  If you add two global integers to the report form like "FirstRec" and "LastRec", you could control it that way.  I would initialize them to 0 and only check them when they were greater than 0 like the following:

 

procedure TfrmQR.DetailBand1BeforePrint(Sender: TQRCustomBand;

  var PrintBand: Boolean);

begin

  with frmQR do

  begin

    if FirstRec > 0 then

       PrintBand := QuickRep1.RecordCount >= FirstRec;

    if PrintBand then

      if LastRec > 0 then

        PrintBand := QuickRep1.RecordCount <= LastRec;

  end;

end;

 

This has NOT been tested, you may have to modify it to get it to work

------------------

Q.  How do I do duplex margins?

A.  QuickReport does not have the built in ability to do duplex margins.  You should be able to do this by changing the margins in the AfterPrint event of the page footer band.

------------------

Q.  How do I keep the preview from rebuilding the report when I print?

A.  When you print from the preview, the report is rendered again.  The reason is the preview is rendered to a metafile, and the output looks better if it's directly rendered to the printer canvas.  You can override this behaviour, when you print a previously saved report, the preview metafile is sent to the printer.

Set the OnGenerateToPrint event of the report's qrprinter object to nil.  This will force the report to not render the report a second time.

Example:

procedure Tfrmqr.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: boolean);

begin

  QuickRep1.qrprinter.OnGenerateToPrinter := nil;

end;

This only works with QuickReport 2.

Please note that with the current release of QuickReport 2if you do this, you will not be able to change any of the printer settings through the standard preview.

------------------

Q.  My report works under 95 but not under NT

A.  When the report crashes at 25 to 50 pages and the OS is NT, then the problem is usually file permissions based.  QR2 renders the report to a temporary file if it can't do it in RAM.  QuickReport calls the Delphi GetTempPath() and GetTempFileName() functions to build the filename.  These functions check directories specified by the TMP, and TEMP variables, and they fail, the current directory.  If the user does not have sufficient access to create a temporary file, then an error will occur.

------------------

Q.  How do I do a title page?

A.  For single column reports add a title band and call the report's NewColumn method from the title band's AfterPrint event.

A.  For multiple column reports, add a title band and set it's height so that no other band will fit on it's page.  One way would be to use the report's BeforePrint event to set the titleband.size.height property

 

The following assumes a page header and footer band...

procedure TfrmQR.QuickRep1BeforePrint(Sender: TQuickRep;

  var PrintReport: Boolean);

begin

  with QuickRep1.Page do

    titleband1.size.height := Length - TopMargin -

      BottomMargin - PageHeaderBand1.Size.Height - PageFooterBand1.Size.Height;

end;

------------------

Q. I can't get AddPrintable to work

A. The Addprintable does not work the way the manual states it will.

The following wont compile:

 

  with DetailBand1.AddPrintable(TQRDBText) do

  begin 

    DataField := 'Test';

 

While this will:

  with TQRDBText(DetailBand1.AddPrintable(TQRDBText)) do

  begin 

    DataField := 'Test';

------------------

Q.  Is there a maximum length/size of a report?

A.  There are no limits on the size of report that can be printed. Preview is limited by the amount of free disk space, however disk usage can be significantly reduced by enabling QuickReport's internal compression.

-----------

Q.  There is a mention of qrsPageCount and QuickReport.Options.TwoPass in the documentation. Are these available yet?

A.  There are references to qrsPageCount and QuickReport.Options.TwoPass in the documentation.  Unfortunately this feature was not completed in time for the 2.0 release.  

-----------

Q.  How can I build a report with data that doesn't come from a BDE table or query?

A.  QuickReport was designed to work with BDE datasources, but it can use data from other sources via the OnNeedData events.  Please see the manual topic for OnNeedData for more information.

------------------

Q.  How do I print only the current record of the dataset?

A.  To print the current record, clear the DataSet property of the report and set the report's PrintIfEmpty property to True.

------------------

Q.  I define multiple TQRlabels on a page.  I can not find the end of the qrlabel.caption to figure out where to start the next qrlabel.

A.  If you use the size properties, this should be easy to do.  If you have two labels, qrlabel1 and qrlabel2, then you would use the following syntax:

qrlabel2.Size.Left := qrlabel1.Size.Left + qrlabel1.Size.Width after you have set the caption properties.

------------------

Q.  Quickreports seems to leave a trail of files of the form QRPDxxx.TMP in the windows temp directory.  Is this a result of normal operation, crash or aborted preview?

A.  These files are created when you preview a report and are deleted when the preview exits.  If your report crashes or is terminated by the IDE, these files will not be removed.  You can safely delete these files at any time.

------------------

Q.  I get the error "Metafile is not valid" when I preview a very simple but large report (2,500,000 lines). The same report with a smaller data table runs OK.  Why do I get this error?

A.  Are you running out of disk space?  QR renders the report to a temporary file and you will get that error message if you are running out of room.  Try setting the report's Options.Compression property to true and see if the report will run.

------------------

Q.  I have an invoice form. If in the form can't put all the details records in one page, and it must go to the next page, I must put a message in the bottom of the form saying something like this " continued on the next page..." or "carried forward ...".  Which is the best solution for this?

A.  There are a few ways to do this.  One way would be to use a summary band with height set to zero and TQRLabel on the page footer that has the text " continued on the next page...".  In the AfterPrint event of the summary band, set the caption of the TQRLabel to ''.  If the summary band prints on the first page, the label will be cleared, if it gets called on the next page, the first page will print the label.

------------------

Q.  How can I do subscripts for chemical formulas?

A.  You would have to use a TQRRichText or a TQRDBRichText control and insert the RTF codes to the text effect.  If you are not familiar with the RTF format codes, an easy way to get the codes is to type the text in MS Word with the formatting and save the file out as a RTF file.

------------------

Q.  I tried using the OnPrint event to change the font style but it does not respond.  Will it show up in the preview, or do I have to compile and run the report from Delphi?

A.  Any code that you put in an event handler will only be executed at runtime.

------------------

Q.  I have a report with just a page header and a title band.  The title band has a memo control that can span multiple pages.  When it does span a page, the text in the memo starts getting chopped up the closer you get to the bottom of the page.  What is wrong?

A.  The report will not work properly without a detail band.  It was designed around it and leaving it out will have odd side effects like the one that you described.  The work around is to add an empty detail band (no controls with it's height set to 0) and the report should print normally.

------------------

Q.  Are there any year 2000 issues with QuickReport?

A.  Year 2000 Compliance (Y2K)

 

QuickReport does not have any Y2K issues in and of itself. If the programmer writes his application to be Y2K compliant, then his reports will be Y2K compliant. This is applicable for all versions of QuickReport.

 

All date and time calculations in QuickReport are done using TDateTime fields. If the data supplied to the QuickReport is Y2K compliant, then the calculations will be Y2K compliant.

 

All date and time fields are displayed with the format masks defined by the programmer. Date format masks that are not defined by the programmer will use the default values supplied by Delphi from Windows.

 

Please be aware that QuickReport is a software development tool. QuSoft cannot control the ultimate quality or accuracy of products developed using QuickReport. Therefore, QuSoft provides no warranty whatsoever in connection with Year 2000 readiness of any software developed by third parties using QuickReport. 

 

Additional information about Delphi Y2K compliance can be found at http://www.inprise.com/devsupport/y2000/

------------------

Q.  The graphics mode of my dot matix mode is too slow, so I'like to know if there is another way to print using the text format of the printer.  I must print using the standard size and the compressed size of the fonts as we used to do in the DOS enviroment...

A.  QuickReport was not designed to do that kind of printing, you will need to be able to set your printer driver that way and I do not have any information on that.

 

An alternative means would be to use the ASCII export filter to send the report to a text file and then copy that file to the printer.  To set any printer and/or font properties, you would have to edit the text file and insert the characters or use a similiar method.

------------------

 

[Multiple Columns]

==================

Q.  When I create multi-column report, second, third etc. columns overwrite children of the title band.

A.  This is a known bug with QuickReport 2.  One work around be to use a pageheader band with child bands.  Since the page header prints after the title, you would put the actual page header information on the last child band and use the preceding page header (and children) for the title information.  In  the BeforePrint events for the bands, you would set PrintBand to false when the page number was greater than 1.

(QR3) This has been fixed with QuickReport 3

------------------

Q.  I have a multiple column report where I want to have two groups, one that forces a page break, and one that forces a column break.  I can set this just fine.  But what happens is when I get the page break, the data prints in the second column of the report and the first column is blank.  Is there a way to supress the column break after a page break?

A.  What you need to do is to set the 2nd group's ForceNewColumn property to false the first time the group is printed on each page.  Then set it back to true to handle the reset of the page.  Set the property to false in the report's OnStartPage event, which gets called at the start of each page.  In the AfterPrint event of the group band, set the property to True so it will work the next time it's called on that page.

------------------

Q.  I am interested in adding the capability of generating mailing labels to my current application.  I could not find any information about mail labels in your documentation.

A.  Doing labels is pretty straight forward.  You set the detailband's height or Size.Height properties to fit the height of your labels and then set the report's Page.Columns property to the number of labels that would go across the page.  You may need to adjust the top and bottom margins of the page to fit your labels.

------------------

Q.  Is there a way to make QReports print columns Left to Right - Top to Bottom instead of Top to Bottom - Left to Right?

A.  This is scheduled for a future QuickReport release.  One work around would be to use multiple sets of TQRLabel controls on a single column detail band.  You would call the report's dataset.next method in the detailband's BeforePrint event and assign the values to the TQRLabels.

------------------

Q.  When I do a multiple column report, the detail bands print on the same line as the group bands

A.  Group bands are the same width as the detail bands and since the colums go down then across, it is posible to have detail bands at the same vertical position (different horizontal position) as group band.  If you want column headers to stay above the detail bands, use the page header to store the header fields.

------------------

Q.  I have a multiple column report that uses subdetail bands but doesn't have a detail band.  I get an exception in the TQRCustomBand.GetBandSize function when I try to run the report.

A.  You must have a detail band for multiple column reports.  This is a known bug and will be addressed in a future release.  If your report does not require a detail band, then just set it's height to 0.

------------------

 

[Paper size issues]

==================

Q.        If the Quickreport.Page.TopMargin is to small then the Top of the Quickreport is not be printed.  Quickreport should tell the user that the Quickreport is out of printable range

A.  This is being considered for a future release.

------------------

Q.  How do I set the paper size?

A.  For detailed information about setting the paper size, please refer to the section on Paper size and Margins (page 2-21) in the QuickReport 2 manual. This manual comes with QuickReport under the filename qr2.doc.

------------------

Q.  How do I determine the default paper size of the selected printer?

A.  The following code checks the printer to see what paper size is the default.

 

with TQRPrinter.Create do

begin

  PrinterIndex := QuickRep1.PrinterSettings.PrinterIndex;

  { for the default printer use the following line }

  PrinterIndex := -1;

  QuickRep1.Page.PaperSize := Papersize;

  free;

end;

------------------

 

[Preview]

==================

Q.        Is there a way to close any open preview forms thorugh code?

A.  You can loop through the list of forms and find each preview form by the class name and then close it.

Example:

  for nIdx := (Screen.FormCount - 1) downto 0 do

    with Screen.Forms[nIdx] do

      if ClassName = 'TQRStandardPreview' then  <-- Substitute or add your class for custom previews

        Close;

------------------

Q.  How can I implement a modal preview? The standard preview isn't modal, when the user make it smaller and click on another form the preview form is hidden. Is there a way to show the preview modal?

A.  Quickreport 2 requires a non-modal preview form to allow the report to process the data.  What you can do is use a custom preview and set it's form style to fsStayOnTop, that would keep the users in the preview until they close it.

(QR3) QuickReport 3 (3.0.1 or newer) has some additional preview methods, PreviewModal and PreviewModeless.  These two methods run in a thread and can not be used with non-thread safe database drivers (like SQL Links).  This limitation will be addressed in a future release.

------------------

Q.  Is it possible to set preview "Fit To Page" as default when opening the preview of a report ?

A.  You can modify the source code for the default preview, or build a custom preview that has this behavior.  We have a sample project for custom previews on our download page that shows how to specify the starting zoom setting for the preview.

------------------

Q.  When repeatedly previewing a report and closing BEFORE the first page is displayed, there is a access violation.

A.  If you are using a custom preview, you must make sure that you have set the qrpreview's qrprinter property to nil when you close the preview.  If you are repeatedly calling preview or print, you may to add code to check the report's state property.  When it'set to qrAvailable (defined in quickrep.pas), then the report is safe to call.

------------------

Q.  Can I preview only selected pages?

A.  There isn't any easy way to preview a range of pages.  As each page is rendered, the preview is notified that the page is now available.  You could have to modify the report to stop after a certain page, but there isn'any way to tell the preview to start at a specific page.

------------------

Q.  Why doesn't the printersetup button work from the preview when I load a saved report?

A.  This is actually a design feature.  When the orientation or paper size was changed, the result was poor output from the saved repots so this functionality was removed from the default preview.  If you build a custom preview, you can use the printersetup on saved reports.  An example project with a custom preview with functionality can be downloaded from our download page under the filename custprev.zip

------------------

Q.  We've a problem with QRPrinter.PageCount. We've created our own Previewform and when we call QRPrinter.PageCount we always get 0. What's wrong??

A.  You need to specify the preview's qrprinter, otherwise the global qrprinter wll be used.  Also, the total page count is not known when the preview is first shown, you must use the preview's OnPageAvailable to update the page count as each page is rendered.

Example:

procedure TfrmPreview.QRPreviewPageAvailable(Sender: TObject;

  PageNum: Integer);

begin

  if PageNum = 1 then

    Caption := QRPreview.QRPrinter.Title + ' - 1 page'

  else

    Caption := QRPreview.QRPrinter.Title + ' - ' + IntToStr(PageNum) + ' pages';

 

  case QRPreview.QRPrinter.Status of

    mpReady: Caption := Caption + ' READY';

    mpBusy: Caption := Caption + ' BUSY';

    mpFinished: Caption := Caption + ' FINISHED';

  end;

end;

------------------

Q.  If I change the Paper Size in the Printer Seup of the preview, the report does not reflect the size selected.

A.  This is a known issue and will be addressed in a future release.  The work around would be to provide a selection of available page sizes to user before you run the report and the set the report's Page.PaperSize property to paper selected.

------------------

Q.  My custom preview does not use the zoom value that I set at design time, how do I get it to start up with the value that I want?

A.  When the QRPreview is created, it defaults with a zoom value of 100, you'll need to set the value after you create the QRPreview.

------------------

Q.  How can I augment the preview's print function to display a dialog box after the report prints?

A.  The default preview wont let you do this, but if you create a custom preview for your report, you can call the dialog after printing.

An example print button event could look like this:

procedure TfrmPreview.PrintClick(Sender: TObject);

begin

  Print.Enabled := False;

  QRPreview.qrprinter.Print;

  Print.Enabled := True;

  MessageDlg('Did we print?', mtconfirmation, [mbOk], 0);

end;

------------------

Q.  How can I determine the number of pages in my report before I preview or print it?

A.  If you call the report's Prepare method, it will generate the report without printing or previewing it.  After Prepare has finished, the pagecount will be in the report's qrprinter.pagecount property.  Please refer to the manual topic on Prepare for more information.

Example:

    QuickRep1.Prepare;

    QuickRep1.ReportTitle := 'This report has ' +

      IntToStr(QuickRep1.QRPrinter.PageCount) + ' pages';

    QuickRep1.QRPrinter.Free;

    QuickRep1.QRPrinter := nil;

    QuickRep1.Preview;

------------------

Q.  How can I have my custom preview print a range of pages without going through the printersetup dialog?

A.  What you need to do is to add a public property of your preview form of type TQuickRep like the following:

 

type

  TfrmPreview = class(TForm)

    QRPreview: TQRPreview;

    .....

  public

    { Public declarations }

    CurrentReport : TQuickRep;

  end;

 

In the OnPreview event of the report, you would use something like:

 

procedure TfrmMyReport.QuickRep1Preview(Sender: TObject);

begin

  with frmPreview do

  begin

    CurrentReport := QuickRep1;

 

    QRPreview.QRPrinter := TQRPrinter(Sender);

    Show;

  end

end;

 

That lets you reference the calling report through the preview's CurrentReport variable.  Then to print out a range of pages with out going through the printer setup, you would do something like the following:

 

  with CurrentReport.PrinterSettings do

  begin

    { To set your own printer }

    PrinterIndex := MyDesignatedPrinterIndex;

 

 { set the page range }

    FirstPage := MyDesignatedFirstPage;

    LastPage := MyDesignatedLastPage;

  end;

  QRPreview.qrprinter.Print;

------------------

Q.  I can't get the cursor to display as an hourglass during custom preview processing.

A.  This is a known issue and will be addressed in a future release

------------------

Q.  I am using custom preview and want to know if there is an easy way to know when the report is done being generated?

A.  When the report is done, the preview's qrprinter.status property will be set to mpFinished.  The following code will display the title, total pages, and status as the preview caption when used as the preview's OnPageAvailable event.

 

procedure TfrmPreview.QRPreviewPageAvailable(Sender: TObject;

  PageNum: Integer);

begin

  if PageNum = 1 then

    Caption := QRPreview.QRPrinter.Title + ' - 1 page'

  else

    Caption := QRPreview.QRPrinter.Title + ' - ' + 

     IntToStr(PageNum) + ' pages';

 

  case QRPreview.QRPrinter.Status of

    mpReady: Caption := Caption + ' READY';

    mpBusy: Caption := Caption + ' BUSY';

    mpFinished: Caption := Caption + ' FINISHED'; { <-- all done }

  end;

end;

------------------

Q.  Why in report preview mode, does the CPU usage for the quick-reports application go to 100%

A.  This was a known issue and was addressed in the 2.0j release.

------------------

Q.  My custom preview doesn'work the way it did with QR1

A.  The preview must be called with Show instead of ShowModal.  This a change from the QuickReport 1 behavior, but is required for QuickReport 2.  We are considering adding a modal preview for QuickReport 3.0

------------------

Q.  Why wont the progress bar work properly with non-BDE reports?

A.  QuickReport 2 checks the TTable or TQuery for the current record number and the total number of records.  These two values are used for displaying the progress bar percentage.  SQL based queries and non-BDE data have no way of telling QR2 what the total number of records is, which is why the progress bar does not update for those kinds of reports

------------------

Q.  Some computers do not display a report and others work fine.

A.  We have seen that happen on machines that do not have a default printer defined.  Without a default printer, QR has no way of knowing how to render the report.

------------------

Q.  When the preview method of a report is called, it looks like the report is being painted twice and there is some flicker

When a form is created the event handlers are executed in the following order:  

   OnCreate   OnShow   OnPaint   OnActivate   OnResize   OnPaint again

A.  This is a known issue and will be addressed with a future release.

------------------

Q.  In QR1, I could disable/hide the save, print and load report speed buttons in the preview. Is this no longer an option?

A.  This is not an option with QuickReport 2.  You would have to create a custom preview and build it with only the functionality that you require for your application.  We have examples on our download page of custom previews for both Quick Report 2 and Quick Report 3

------------------

Q.  Some lines do not appear in the preview, but they appear in the printout.

A.  The report is rendered to a TMetafile object when it is sent to the preview.  Depending on the zoom value of the preview, the scaling of the TMetafile may crop out some of the lines.  If you zoom in (you may need to use a custom preview to zoom in close enough), the lines will reappear. 

------------------

Q.  How can I tell in BeforePrint if I am Printing or Previewing?

A.  In the report's BeforePrint event, you can check the value of the report's QRPrinter.Destination property.  If it's set to qrdMetafile, then it's rendering the preview.  If it's set to qrdPrinter, then it's rendering the report directly to the printer.  This only works when you are generating a report, if you load a saved report, the destination will always be qrdMetafile.

------------------

Q.  Is there a way to tell QuickReport that when you generate a preview, you only want the preview to span a certain number of pages or have a starting/ending page number?

A.  You can't tell the preview to start at a specific page, but you can get it to stop after a specified number of pages.  You can use the OnEndPage event (documented in the manual) to get the report to stop processing after the specified number of pages.  If you do this an extra blank page will be generated, there isn't much you can do to get around that.  The following example shows how to stop the preview after only 32 pages without affecting the number pages when you print from the preview:

 

procedure TfrmSomeReport.QuickRep1EndPage(Sender: TQuickRep);

var

  nIdx: integer;

begin

  {

  This code will only take affect when previewing, you will need to

  add qrprntr to the uses clause.

  }

  if QuickRep1.QRPrinter.Destination = qrdMetafile then

    if QuickRep1.PageNumber = 2 then

    begin

      {

      Disable the printing of all bands, requires 2.0J or later.

      If you do this, remember to renable the bands in the reports

      BeforePrint event the next time you run the report.

      }

      for nIdx := 0 to QuickRep1.BandList.Count - 1 do

        TQRCustomBand(QuickRep1.BandList[nIdx]).Enabled := false;

 

      {

      Tell the report that we are done reading data.

      }

      QuickRep1.qrprinter.cancel;

    end;

end;

 

Make sure to have the following code in the report's preview to re-enable the bands again.

 

procedure TfrmSomeReport.QuickRep1BeforePrint(Sender: TQuickRep;

  var PrintReport: Boolean);

var

  nIdx: integer;

begin

  for nIdx := 0 to QuickRep1.BandList.Count - 1 do

    TQRCustomBand(QuickRep1.BandList[nIdx]).Enabled := true;

end;

------------------

 

[Printing and PrinterSetup]

==================

Q.  Is there any way to prevent QuickReport from doing a page eject (formfeed) at the end of a page or print job?

A.  As long as you use printing via the windows printer driver (TPrinter and TQRPrinter both use this) there is no way to avoid the page eject after the print job has finished. This behaviour has been built by MS into the printer driver design, for a good reason. The system has to be able to deal with several apps running in parallel printing all to the same printer and it assumes that each job starts on a new page.

------------------

Q.  How do I print to a file without changing the printer's setup, or getting a prompt for a file to print to?

A.  This is the title of a FAQ from the Inprise Delphi Developer support page.  This question is answered at http://www.inprise.com/devsupport/delphi/qanda/1599.html 

------------------

Q.  When you look in the que for a print job, Quick Report print jobs have no name.  How can I give a Quick Report printout it a name for the que?

A.  Did you set the ReportTitle property of the report?  This gets passed to the TPrinter object when you print and that value will be used as the name of the print job.

------------------

Q.  I have a PC with a HP692C deskjet printer as default and when I try to print QuickReport raise the error : Printer index is not valid. Only with this printer. 

A.  This message doesn't come from QuickReport, it comes from the Delphi printers unit.  You can get this message if you try to specify a printer option that the printer driver does not accept.  If you copy the printers unit (if you have the VCL source code) to your project directory and add it to the project, you put break points in it to see which setting is causing your problem.

------------------

Q.  I get a printer error when I print a range of pages.

A.  There is a known problem where a range of pages will cause an error when you have controls that cause a band to stretch.  The length of a band that stretches is not known until the band is actually printed.  If pages are skipped, the page count is off and report throws an error.  This will be addressed in a future release.

------------------

Q.  I am setting the control's font to Arial but it is printing as Courier (or vice versa).

A.  Check the control's Font.Pitch property.  If you select Arial and set the pitch to fpFixed, Windows will substitute the closest match that supports that pitch.

------------------

Q.  I can't get the Bin Selection for quick reports to work. No matter what I try, everything goes to the same bin. How do you select output bins?

A.  You should be setting the report's PrinterSettings.Outputbin property to the bin that you want to use.  Only the bins listed on the manual page for the outputbin property (5-121) can be selected.  Device specific bins are not supported at this time.  If the printer'default bin is a device specific bin, you may have to set to another bin in order for QR2 to be able to select a bin.

------------------

Q.  I am trying to layout my report to print using the Generic/Text Only driver, but I am having trouble getting the text to line up and blank lines get inserted into the printout.

A.  This is what I do when I am designing a report for the Generic/Text only driver.

 

Set the report units to Characters.

Set the report font to 'Courier New' and the size to 10.

Set the height of the band to slightly less than the height of the text controls.  The default height of the QRDBText control is 17 when I use these settings.  I set the detailband height to 16.  This should eliminate any extra blank lines from the output.

------------------

Q.  I don't see the progress window during the print when I use:

myreport.quickrep1.Prepare;

myreport.quickrep1.QRPrinter.Print;

myreport.quickrep1.QRPrinter.Free;

myreport.quickrep1.QRPrinter := nil;

How do I enable the progress window using the above code?

A.  The progress windows is not applicable to that method as the report is not being generated at print time.  The report was rendered to a metafile with the prepare method and the print method is just copying the metafile to the printer.

------------------

Q.  I'm getting a 'Printer is not currently printing' error when I try to print a report, I have not been able to find a reason for this, it only happens with certain reports. (Others print without problems)

A.  Check the report.printersettings.FirstPage and the report.printersettings.LastPage properties.  If they are set to values outside of the number of actual pages in the report, you will get this error at runtime.

------------------

Q.  The printout doesn't match the preview exactly.

A.  We use Windows API calls to get the font height and width information back and some fonts do not return the correct information. 

------------------

Q.  I have a report that prints fine on a HPIII printer but not on the HP4.  Either the text is missing, or the bands print black.

A.  There have been many reports of problems with the HP4 (and Hp5) printers.  You should make sure that you are using the current driver from HP's web site (http://www.hp.com/cposupport/jsnav/prhome.html).  You may also need to check the page protect option in the printer driver and/or set the DPI to 300.

------------------

Q.  The output from preview is correct, but printing from the preview does not print all of the data or the data has values from the last run of the report.

A.  If the problem is only when you print from a preview, then you will need to reset your data (datasets and/or variables) in the BeforePrint event of the QuickReport.  This event gets called whenever the report needs to be generated.

When the report is regenerated, sometimes you will have to reset your dataset.  One example is if the dataset has a memo and you are connected to a SQL database server like Oracle.  The problem seems to be in the BDE's BLOB caching.

Another situation would be if you are using OnNeedData and that event is controlled by a variable that needs to be initialized at the start of the report.

------------------

Q.  How can I tell how the user exits the report's PrinterSetup method?  It does not pass back the status.

A.  You can test the value of report's tag property (with version 2.J or newer) after calling PrinterSetup and if it'1, then they selected OK.  

Many users have asked for the ability to print automaticly if the user selects OK from PrinterSetup.  You would code that like this:

 

  with frmReport.quickrep1 do

  begin

    PrinterSetup;

    if tag = 0 then

      print;

  end;

 

To do this in the preview will require using a custom preview and passing in a reference to the calling report to the preview.  That will allow you to call PrinterSetup and be able to check the tag value.  We have a sample preview that does this and it is available upon request.

------------------

Q.  How can I check to see if the user cancelled the printing of a report?

A.  You can use the AfterPrint of the report to set a flag as it will only get called if the report prints to completion.

A.  (QR3) The report has a Cancelled property that gets set to True if the user cancels a report.

------------------

Q.  How do I determine the paper size of the printer at runtime?

A.  If you use the following code before you call your report, you can specifiy the default size:

with TQRPrinter.Create do

begin

  Printerindex := -1;

  QuickRep1.Page.PaperSize := PaperSize;

  Free;

end;

 

This assumes that you are using the default printer and your report is named QuickRep1.

------------------

Q.  After calling QuickRep.PrinterSetup to pick a specific printer, what's the best way to get the name of the printer that was just chosen?

A.  The printerindex is stored in the report's printersettings.printerindex property.  The following example will set the form's caption to the current printer for the selected report:

 

  with TfrmReport.Create(Application) do

  begin

    QuickRep1.PrinterSetup;

    self.caption := printer.printers[QuickRep1.printersettings.printerindex];

    QuickRep1.Preview;

    Free;

  end;

------------------

Q.  I can not get the PrintBackground to work. In the preview sample I added a menu with the code:

procedure TMain.PrintBackground1Click(Sender: TObject);

var

  aForm : TReport1Form;

begin

  Application.CreateForm(TReport1Form, aForm);

  aForm.QuickRep1.PrintBackground;

  aForm.Free;

end;

When the PrintBackground method is called an exception is raised.

A.  You are freeing the report while it is printing in the background.  You can't free the report until it has finished printing.  The following example creates a report, calls PrintBackground, and then waits until it has finished before freeing the report:

Application.CreateForm(TfrmGroupTest, frmGroupTest);

with frmGroupTest do

begin

  QuickRep1.PrintBackground;

  while QuickRep1.QRPrinter.Status <> mpBusy do

    Application.HandleMessage;

 

  while QuickRep1.Available = False do

    Application.HandleMessage;

 

  Free;

end;

------------------

Q.  We have an application, that prints a form developed in QR 2.0i. During development we used a LEXMARK printer an everything worked fine. But our customer have another printer a Kyocera, on that printer the print doesnt work.

A.  One thing to look at is how complicated your form is and how much memory is in each printer.  QuickReport renders each page to the printer canvas supplied by the printer driver.  If the printer resolution is set too high and it doesn't have enough ram to render the entire page, you will get garbled or missing output, depending on the printer and/or driver.  One way to verify that this is the problem would be to lower the printer's resolution through it's driver and then try to print the report.

------------------

Q.  I'm trying to write a report that gets printed to the windows generic text-only printer driver.  Some lines move around when it is actually printed.  Do you have any ideas?

A.  Try setting the report's font to "Courier New" at size 10.  Then set the height of the band to 16 and if that cleans up the output.  To save paper while testing this, set the printer driver's destination to "FILE:"

------------------

Q.  How can I send control chars to the printer with Quickreport?

A.  QuickReport uses the Windows printer driver GDI calls to output data, it does not support sending escape codes directly to the printer.  You could use the ASCII text export filter to save the report as text.  You would then insert your printer escape sequences into that file and then copy that file to printer port.

------------------

Q.  I can't set the printer at runtime, I get an exception if I use the following syntax:

Quickrep1.Printersettings.printerindex:=Quickrep1.printer.printers.Indexof('HP LaserJet 4 on LPT1:');

A.  QuickReport does not create it's printer until it needs it, you'll need to use a regular printer object that Delphi will initialize for you. the following code will work:

Quickrep1.Printersettings.printerindex:=printer.printers.Indexof('HP LaserJet 4 on LPT1:');

------------------

Q.  How can let the users select the printer before running the report?

A.  If you call the Report's PrinterSetup method, this will set the printer settings for the report before you run it.  You could do it like:

 

  with frmReport do

  begin

    QuickRep1.PrinterSetup;

    QuickRep1.Preview;

  end;

------------------

Q.  I retrieve the values of the Delphi PrinterSetupDialog and when I use the printerindex returned by it, I get the error: PRINTER INDEX OUT OF RANGE

A.  There is a bug in the Delphi printer setup dialog that causes it to create new instances of printers in the printer list. QuickReport 2.0i (and later) includes a fixed printer dialog in the qrprnsu unit. Please use that instead of Delphi's dialog.

------------------

Q.  When I change the printerindex, I can'select the right paper size.

A.  There is a problem in the printers unit where when the printerindex index is changed, the new printer "inherits" the properties of the previous printer.  With the 2.0j release, we now reset the printer driver when the printerindex is changed.

------------------

Q.  When I use Printer Settings from within QuickReport, it suggests me to write out all 10000 pages, even though my report contain only 10-15 or so...

A.  This is a cosmetic bug (the report will never print out anything past the last page) and this will be fixed in a future release.

------------------

Q.  I can't select a tray for HP printers

A.  The printer dialog QuickReport uses is a standard print setup dialog. QuickReport defaults to the Default tray defined in Windows. I believe the problem with some printer drivers (LJ5/6) is that they try to redefine the tray order. We will look for a solution to this for a later version.

One work around is to use the LaserJet III driver when printing with QuickReport.

------------------

Q.  Number of copies does not work for local printers

A.  It's due to a Delphi bug and a workaround will be in our next release.

------------------

Q.  How do I the printer properties if I use my own printersetup dialog box?

A.  Please see the TQuickRep.PrinterSetup method in quickrpt.pas for code showing how to set the printer to what was selected in the setup dialog. 

------------------

Q.  I get an extra blank page when I print a range of pages.

A.  The extra blank page is a known issue and was addressed in the 2.0k release.

------------------

Q.  Why do the Properties QRPrinter.Canvas.TextHeight and TextWidth return always zero value when running in 16 bits?

A   The QRprinter.Canvas is a standard metafile in Delphi 1 and a standard metafile doesn't support these functions. Enhanced metafiles in Delphi 2/3 does.

------------------

Q.        The report prints under Win95 but not under Win 3.1

A.  This is probably a printer driver problem even though they use the latest driver. A possible solution might be to try to blank the QRPrinter.OnGenerateToPrinter event to see if that helps.

A workaround is to clear the QuickRep.QRPrinter.OnGenerateToPrinter event, setting it to NIL when the preview is brought up. This will force QR to print the generated metafiles instead of generating the report all over directly to the printer. The down side is that you might experience a slight scaling of the report page and that images might have a lower resolution.

------------------

Q.  When I use printer fonts, the preview does not match the print out.

A.  A possible solution to this problem is to assign the printer specific font to your report at runtime. If you use the same font for all controls in your report you should be able to say

 

QuickRep.Font.Name := 'Your font name'

 

before starting your report. If Windows is able to to a reasonably good substitution it should work.

------------------

Q.        When I use the QRPrinter object, the scaling is off

A.  There are some known problems with using the QRPrinter object in this way.  With the 2.0h release, we have added a new class, QRPrintJob, which is a wrapper for the QRPrinter object.  This code is in the \quickrep\demos\qrprntr directory and makes it easier to do code like what you sent in.

------------------

Q.  When i use the EPSON LQ-1070+ printer driver  the program closed, no error message

A.  There is a known problem with using QuickReport with printers that support more than 64 different page sizes.  This will be addressed in an upcoming release.  At the present time, there is no work around, short of using a generic epson combatible printer driver.

------------------

Q.  When I print my reports under NT 4, the font changes are not working correctly.

A.  There is a known printing problem with Windows NT 4.0 when you have multiple font changes on the printer canvas.  Installing the Service Pack 3 to NT should solve the problem.

------------------

Q.  I get a exception error when running our application on a machine without a default printer.

A.  QuickReport requires that a default printer be installed.  The report is prepared using information from the printer driver.  The following code shows one way to check and see if a default printer has been defined.

procedure TfrmReport.btnReportClick(Sender: TObject);

var

  FDevice:     PChar;

  FDriver:     PChar;

  FPort:       PChar;

  FHandle:     THandle;

  CurrentPrinterName: string;

begin

  GetMem (FDevice, 255);

  GetMem (FDriver, 255);

  GetMem (FPort, 255);

  Printer.GetPrinter (FDevice, FDriver, FPort, FHandle);

  CurrentPrinterName := FDevice;

  if FDevice <> nil then FreeMem (FDevice, 255);

  if FDriver <> nil then FreeMem (FDriver, 255);

  if FPort <> nil then FreeMem (FPort, 255);

 

  if CurrentPrinterName <> '' then

    { Preview the report }

    QuickRep1.Preview

  else

    MessageDlg('You do not have a default printer defined.' +

               #13#13 + 'Please select a printer before running a report.',

               mtError,[mbOK],0);

end;

------------------

Q.  How do I print to a printer different than the Windows default printer?

A.  Set QuickRep.PrinterSettings.PrinterIndex to a value corresponding to the printer you want to print to. This value is the same as for the Delphi TPrinter.PrinterIndex. Set to -1 to print to the default printer again

------------------

Q.  I have some easy reports very simple ones (without graphics), but in a matrix printer they are printed very slowly. Is there a way to print them like the DOS programs did in PRINT, and TYPE filename.ext > PRN?

A.  QuickReport renders a report to the printer driver's canvas.  It doesn't really have a text mode for printing, rendering the pages is left completely up to the printer driver.  You can try using the the "Generic / Text Only" printer driver that comes with Windows.  You may have to modify the fonts and/or control placement with the report to get satisfactory results with this driver.

------------------

Q.  I would set to specify a default printer to be used for multiple reports.

A.  You have to add the code to determine what the printerindex value is for the printer.  Then set the QuickRep1.PrinterSettings.PrinterIndex property to this value for each report before you call the print or preview methods

------------------

Q.  My report only prints one page, but the designtime preview shows all pages.

A.  Check the report's PrinterSettings.FirstPage and PrinterSettings.LastPage properties and make sure that they are set to 0.  If you print a range of pages from the designtime preview, these two fields may get set to the values that you had selected. 

------------------

Q.  How can I print multiple copies of a report without having to generate it over and over again?

A.  You would set the report's PrinterSettings.Copies property to the value that you want.  Not all printer support this property.

 

Another way to print multiple copies is to use the prepare method instead of calling the print method directly.  For example:

 

Instead of:

  with TfrmQR.Create(Application) do

  begin

    QuickRep1.Print;

    free;

  end;

 

Try:

  with TfrmQR.Create(Application) do

  begin

    QuickRep1.Prepare;

    QuickRep1.QRPrinter.Print;  { print first copy }

    QuickRep1.QRPrinter.Print;  { print second copy }

    QuickRep1.QRPrinter.Free;

    QuickRep1.QRPrinter := nil;

    free;

  end;

 

This method generates the report to an internal metafile and then rendered report is sent to the printer twice.

------------------

Q.  I am getting printer overrun errors with some reports when I print to my laser printer

Q.  Some reports are printing dark bands on my laser printer.

A.  These problems can happen when you send a full page to a laser printer and that printer does not have enough RAM to print a full page at the specified DPI.  Try reducing the DPI or adding more RAM to the printer.

------------------

Q.  When I call the printersetup dialog, it always shows the default printer, even if I have preset the printerindex to another printer.

A.  This is a bug in Borland's dialog, it always comes up with the default printer no matter what the printerindex is set to.

------------------

 

[QREditor]

==================

Q.  I want to be able to execute a report made in "QREditor" (*.qr) without using the QREditor.  How can I do this so the user can not edit the report?

A.  You can load a qreditor report with the QRLoadREport function (defined in the qrextra unit).  Remember to add the qrextra unit to your uses clause.  The following code shows how load, preview, and finally free a saved report:

 

procedure TfrmTest.btnQRLoadReportClick(Sender: TObject);

var

  MyReport: TQuickRep;

begin

  try

    MyReport := QRLoadReport('myreport.qr');

    MyReport.Preview;

  finally

    QRFreeReport(MyReport);

  end;

end;

------------------

Q.  I'like to know how to use my QR files made by Delphi 3 with the release of Delphi 1.

A.  The .QR files saved by the QREditor are form description files (.DFM) and DFM files are not downwardly compatible.  You will need to either create your .QR files with Delphi 1 or manually edit them to remove the properties that are not supported with Delphi 1.

------------------

Q.  Where can I get documentation for the QREditor?

A.  We will be updating the documentation and help with the 2.1 release due out in a few months.  A pre-release help file for the QREditor can be FTPed from ftp://ftp.qusoft.no/pub/quickrep/qredithl.zip

------------------

Q.  How can I send parameters to the QREditor when using a Query?

A.  This is not directly supported in the current release.  What you can do is to load the saved report and modify the query properties.  While you can't pass parameters, you can build an SQL statement with those parameters embedded in the text of the SQL statement.  The following example loads a previously saved report and replaces the SQL property if a TQuery was being used or it sets the filter if a TTable is being used:

 

procedure TfrmMain.Button1Click(Sender: TObject);

var

  MyEdit: TfrmQREdit;

begin

  MyEdit := TfrmQREdit.Create(Application);

  with MyEdit do

  begin

    show;

    qreditor1.OpenReportFile('cust1563.qr');

    if qreditor1.Report.DataSet is TQuery then

    begin

      with TQuery(qreditor1.Report.DataSet) do

      begin

        SQL.Clear;

        SQL.Add('select * from customer where CustNo=6312');

        Open;

      end;

    end

    else

    begin

      with TTable(qreditor1.Report.DataSet) do

      begin

        Active := False;

        {$ifdef win32}

        Filter := 'CustNo=6312';

        {$endif}

        Active := True;

      end;

    end;

    qreditor1.Report.Preview;

    Close; { if you want to make the editor go away after the preview }

  end;

end;

------------------

Q.  After pressing the open button on the QREditor and cancelling this action the buttons do not return to the original state and the 'new' button is disabled.

A.  The demo editor project shows how to add a menu to the qreditor with ability to reenable the new button.

------------------

Q.  The QREditor's NewImage button is commented out.  When will this be enabled?

A.  This function will be added to a future release.

------------------

Q.  Can I use the PAGE function somehow in TQREditor?

A.  This will be in the 3.0 release (due out in 98)

------------------

Q.  I am interested in the TQREditor component, but I have a question: How can I create a master-detail report throught the component?

A.  At the current time, the QREditor component is limited to a single dataset.  This functionality will part of a future release.

------------------

Q.  When working with the QREditor, the Title band does not get previewed nor printed.  All the layout options and the band properties appear to be set correctly, but the band will not preview or print.

A.  Have you defined a dataset for this QREditor report?  If you do not have one, the title band will not be output.

------------------

Q.  Is it possible to bypass the login dialog when I want to report data from a database server with the QREditor? (by providing username and password via code)

A.  With the BDE, you'll need to use a TDatabase component and set the username and password via the params property.  You can't add this to a report created by QREditor, but if you put the component on the same form as the QREditor, this should work.  I tested this with a password protected MS Access database and it worked.

------------------

Q.  I'm using Quickreport editor and I found a problem. If I want to put in a report a label and its caption is the same name of a dataset field's, I can't put this label caption in the report.

A.  This is a known problem and will be addressed in a future release.  One work around is to use a SQL statement to rename the columns in the table so that the names do not overlap.  Example

 

SELECT OldName AS NewName FROM SomeTable

------------------

Q.  The fields in the QREditor are printing as the field names instead of the values.

A.  When you select a dataset with the editor, it names it either TTable1 or TQuery1.  If you have datasets with the same name, this can cause a conflict with the QREditor where it tries to use the wrong dataset.  Renaming the other datasets removes this conflict.  This will be addressed in a future release.

------------------

 

[QuickReport 3]

==================

Q.  When I set PrintBand to false, the dataset fields for that line are excluded from the TQRExpr functions.  In Quick Report 2, these fields are included in the calculations.

A.  This is a feature that had been requested by many users.  It had been expressed to us that if a band was suppressed, it's data should be excluded from the accumulator functions like SUM().  To emulate the Quick Report 2 code, instead of setting PrintBand to false, set the height of the band to 0 when you want to suppress it and still use it for functions.  Just remember to set the height back to the design time height when you do want to print the band.

------------------

Q.  Everytime I preview a report with my custom preview, I lose some memory.

A.  You will want to check your preview's FormClose event.  If you are using code from Quick Report 2, that code may not work correctly.  You may want to compare your close event code with the code used by the standard preview.

------------------

Q.  I can't find the qrbonus unit.

A.  The classes that were the qrbonus unit are now in the qrextra unit.

------------------

Q.  I have a report with some controls on a TQRBand and the preview is emtpy.

A.  You must have a detail band, this is required for Quick Report 3.  Using reports without detail bands was an undocumented feature of Quick Report 2 and was never supported.

------------------

Q.  (Delphi 3) I am getting an error when I compile with runtime packages enabled.  With out runtime packages, it works fine.

A.  The package list will not get updated automaticly when you install QR3 over QR2 and you may have the QR2 runtime package (qrpt30.dpl) on the list instead of the Quick Report 3 runtime package (qrpt43.dpl)

------------------

Q.  I have a report that does not print the DetailBand (DetailBand1BeforePrint() sets PrintBand to False).  With version 2 of QuickReport, SUM() expressions in groups incremented their values whether or not the detail band printed.  In version 3.0.4, it appears that the SUM() expression only increments if the detail band prints.  What can I do to change this behavior back to how version to handled this?

A.  This was actually a change that had been requested by other users.  There is a simple work around that you can use in the BeforePrint event.  Instead of setting PrintBand to False, set the band height to 0.  If you need to restore the height, set the tag property of the band to the height and restore the height from the tag in the band's AfterPrint event.  The report will still think that it printed the band, but the size will be 0 so you will not see the band and your sum will include the data from the hidden records.

------------------

Q.  (Delphi 3) My users can not see the buttons on the preview's toolbar.

A.  What version of comctl32.dll is on your system?  The preview uses a TToolbar control and that control will not display glyphs from an imagelist when the destination computer has an older version of this dll.   It was compiled for version 4.72.  You have a couple of options.  You can get the free update from MS for the current comctl32.dll, or you can recompile the QR package against the old version of comctl32.dll (not reccommended), modify the standard preview in the qrprev unit so that it does not use TToolbar, or you could use a custom preview that does not use a TToolbar control.  We have Custom Preview examples on our download page and with QR3, you can change the preview on a global basis.  There is an MDI demo example on our download page that shows how to do this.

Delphi 4 requires (and installs version 4.72)  You can download the file directly from Microsoft at the URL http://msdn.microsoft.com/developer/downloads/files/40comupd.htm

------------------

Q.  With QuickReport 2, I could set OnGenerateToPrinter to nil to keep the report from being regenerated.  How do I do this in Quick Report 3?

A.  The OnGenerateToPrinter property is a QR2 only property, it doesn't exist in QR3.  There are a couple of ways to do this in QR3.  You can set set the report.qrprinter.master property to nil in the BeforePrint event of the summary band.  If you don't need a summary band, you can set PrintBand to false in that event.  You could also use a custom preview and change the print button to call the preview's qrprinter.save to a temporary file and then qrprinter.load.  You would then call the qrprinter.print method to print the loaded report.

------------------

Q.  I think I have installed version QuickReport 3 correctly with Delphi 3, and it prints short reports if I call the PRINT command. If I use preview however, I receive a "Control has no parent window error" when I press the print button. I didn't have this problem with Version 2.0K.

A.  The DLL needs a reference to the calling application so that the DLL's forms are children of the application.  Please see the Delphi help page for TApplication.Handle.

------------------

Q.  I am trying to compile a report from QuickReport 2 and I get the message "Undeclared identifier TQRDetailLink."

A.  The TQRDetailLink class was a QuickReport 1 object.  QuickReport 2 had partial support for this control and it was treated as an alias to the TQRSubDetail control.  QuickReport 3 does not have any support for reports that were ported from QuickReport 1.  If you replace the TQRDetailLink controls with TQRSubDetail controls, your report should run like it did under QR2.  The TQRDBCalc control from QR1 will also produce the same error.  This was replaced with the TQRExpr control.

------------------

Q.  I am creating an end user report generator and use the TQRDesigner to enable objects edit and selection functions, but I couldn't find it in the new version.

A.  The TQRDesigner is no longer part of the package, we use the Delphi form designer to edit the report.

------------------

Q.  I just installed Quickreport 3.03 Pro for Delphi 3 Client/Server and recompiled (Build All) a project that worked fine with QR 2.0j.  In order to get it to compile, I had to remove unit QRHTML from all uses clauses because I got a fatal compile error that QRHTML was compiled with under different version

A.  The qrhtml unit is a QuickReport 2 only unit, it is not part of the QR3 file set, you can remove all of the references to it.  If you may many reports that use the unit, it would save time to create a stub unit named qrhtml that didn't have anything in it.  When you get that error message with QuickReport 3, it usually means that the compiler is finding QuickReport 2 files.

------------------

Q.  I have some variables defined in the report's functions property and I can't initialize them in the report's BeforePrint event.

A.  The report's BeforePrint event is called before the elements in the report's functions property have been initialized.  One way to initialize the function variables in code would be to use the BeforePrint event of the TitleBand.  If your report does not require a title band, set PrintBand to false in that event.

Example of setting an integer value at the start of the report:

procedure TfrmExpr.TitleBand1BeforePrint(Sender: TQRCustomBand;

  var PrintBand: Boolean);

var

  aQREvElement: TQREvElement;

begin

  with QuickRep1.Functions do

  begin

    aQREvElement := GetConstant('test');

 

    if (aQREvElement <> nil) and (aQREvElement.Value(nil).Kind = resInt) then

    begin

      SetIntegerConstant(aQREvElement, 10);

    end;

  end;

end;

 

------------------

Q.  I get the error message "Undeclared identifier; 'TQREvaluator'" when I compile a report that worked with QuickReport 2

A.  We moved the expression classes to a new unit, qrexpr.  If you add this unit to your uses sestion, the report will compile again.

------------------

Q.  I have a simple project which has a quick report, no bands, just a few labels, memo boxes, and pictures.  It worked prior to my upgrade to a purchased version.  Now if I do a Preview, the screen is blank, no data, as well as if I do a print, nothing happens.

A.  QuickReport was designed to work with bands.  Placing controls directly on the band was a non-supported feature of the previous version.   Try adding a detail band (set it's height to 1) and then set the report's PrintIfEmpty property to true.  Your report should now work as it did with QuickReport 2.

------------------

Q.  Delphi4 doesn't find the class "TQREvElementFunction" and my project will not compile.

A.  Make sure the qrexpr unit is in the uses clause, that is where the TQREvElement structures are defined.

------------------

Q.  The following code does not compile after upgrading: ReportForm.ExportToFilter(TQRHTMLExportFilter.Create(AttachmentFile));

A.  The naming was changed.  The following code will work: ReportForm.ExportToFilter(TQRHTMLDocumentFilter.Create('c:\report.htm'));

------------------

Q.  Can we use some TQRGroup with a TQuickAbstractRep control ?

A.  Not really, the TQuickAbstractRep does not have a DataSet property or OnNeedData event.  The mechanism for checking the group expression does not exist and the band would be printed only once.

------------------

Q.  Where are the documentation, helpfiles, examples, QREditor, etc?

A.  QuickReport 3 is still being finished up and the documentation and help files are still being updated.  We will release them, but our efforts are focusd on finishing up the package.  The QREditor control will be in the release version of QuickReport 3 Pro.

------------------

Q.  What is the TQuickAbstractRep control?

A.  This is a descendant of the TCustomQuickRep base class that does not use the TDataset.  If your application does not use the BDe, this will shrink the code size.

------------------

Q.  Why do report event use TCustomQuickRep instead of TQuickRep?

A.  This is the base class that TQuickRep is descended from.  This change makes it easier to do variations QuickReport objects

------------------

Q.  What happened to OnGenerateToPrinter?

A.  This feature has not been finished yet and has been disabled until it has been fixed.

------------------

Q.  Are there any plans to continue support of QR1 in Delphi 4 like was done in Delphi 3 with QR 1.1b?

A.  This fileset is available from our sales department upon request.

------------------

Q.  What is the TQRLoopBand control?

A.  This is a band that is not connected to any dataset and will print for the number of times that it's PrintCount property is set to.

------------------

Q.  What is the TQRStringsBand control?

A.  This is a band with a items property that is a built in stringlist.  It's name will appear in the expression builder and can be assigned to a TQRExpr control.  At runtime, this band will print for each line in the items proeprty.

------------------

Q.  How do you use the export filter controls?

A.  Just drop them on a form in your project and they will show in the previews.

------------------

Q.  What is the new 'LinkBand' property?

A.  This works like the LinkBand property in QuickReport 1.  The Band components have a LinkBand property which is used to make several bands stick together. The LinkBand property can be set connected to another Band and QuickReport will then make a page break if there is not enough space left on the page for both bands. The second band can in turn be linked to a third band, and so on.

------------------

Q.  How can I display a text file with QR3?

A.  Qr3 has some new functions to make this an easy task.

#1 Create a report using the TQuickAbstractRep control instead of using the TQuickRep control.  The TQuickAbstractRep control does not use any dataware controls and can shrink the size of your executable oif you are not using any dataware controls in your application.  You can use the TQuickRep control, you just don't need to use it.

#2 Add a TQRStringsBand to the report.  This is a band with a items property that is a built in stringlist.

#3 Add a TQRExpr control to the band.  Set the following properties

Autosize - False

AutoStretch - True

Expression - to the name of the band (like 'QRStringsBand1')

Width -  to the width of the band (can be done at runtime)

#4 Before calling Print or Preview, load the text file into the items property of the TQRStringsBand like this:

QRStringsBand1.Items.LoadFromFile(SomeFileName)

#5  Call the preview or print methods.

------------------

 

[RichEdit controls]

==================

Q.  I get an access violation when I have QRDBRichText on a subquery

A.  This is a recently discovered problem that happens with TQuery's that do not have persistant fields.  Adding persistant fields will fix this.  If you can not do this, insert a line into the TQRDBRichText.Print method in qrctrls.pas like the following example using the 2.0k beta code:

procedure TQRDBRichText.Print(OfsX, OfsY : integer);

begin

  Field := FDataSet.FindField(FDataField);  { Add this line }

  if assigned(Field) then

    if (Field is TMemoField) or

       (Field is TBlobField) then

      Lines.Assign(Field);

  inherited Print(OfsX,OfsY);

end;

------------------

Q.  My RTF field will not span more than one page

A.  There are some serious bugs in Microsoft's implementation of their RichText common control.  We are implementing work arounds to resolve as many of these issues as we can.  At this time we are still working on RTF fields that span more than one page.

------------------

Q.  My RTF field doesn't consistantly print out the last line in the memo.

A.  This is known problem with the MS RichText common control.  There are two works arounds.  One is to add an extra blankline to the text, the other is to set the OnGenerateToPrint event of the report's qrprinter object to nil.  This will force the report to not render the report a second time.

Example:

procedure Tfrmqr.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: boolean);

begin

  QuickRep1.qrprinter.OnGenerateToPrinter := nil;

end;

------------------

Q.  Can I print a richtext object that is in a field of a file with ole2 bmp object inserted in it?

Q.  My QRRichText control is ignoring the "\page" page break command.

A.  I'm sorry, but the TRichEdit control that the QRRichText and QRDBRichtext controls link to is limited to text only and it does not appear to support this feature.  Our controls are limited to the functionality of Borland's RichEdit control, which is a  wrapper for Microsoft's RTF control.   The MS RTF common control only supports a subset of the RTF control codes.  To see what sequences are supported, load your RTF text into WordPad.  WordPad uses the same common control and if it doesn't support an RTF control sequence, then it wont work on Delphi.

------------------

Q.  My QRDBRichText control is not resizing correctly.

A.  If the designtime height of a QRDBRichText control is greater than some of the fields, it may not resize correctly.  If you set the height to a small value like 10 and set autostretch to true, it should work.

------------------

Q.  My QRRichText/QRDBRichText will not display or print embedded bitmaps.

A.  The TRichEdit and TDBRichEdit controls do not support embedded objects and since our RTF controls use the Borland RTF controls, we have the same limitation.

------------------

 

[Saved Reports (*.QRP)]

==================

Q.  I am using the QRPrinter object and I can't get it to save to a text file.

A.  Saving as text uses the ASCII export filter and the export filters only work with reports.  When you use the qrprinter object directly, the only save option is the default .QRP save.

------------------

Q.  If I save a report with the Report's Options.Compression property set to true, I can't load the saved the report back into the preview.

A.  This is a bug in the TMetaFile component introduced with Delphi 3.02.  This should be addressed in the next Delphi release.

------------------

Q.  How do I load a previously saved report via code?

A.  We have a new class, TQRPHandler, that is defined and documented in the QRBonus unit.  This class is designed to easily allow you load a saved report using the following syntax:

 

  with TQRPHandler.Create do

  try

    Filename := 'somefile.QRP';

    Preview; {or}

    print;

  finally

    Free;

  end;

 

There is a bug in current release that will prevent this from printing with Delphi 1, this will be addressed in a futur release.

------------------

Q.  What is the format of a report saved to disk by clicking the save button in the previewer?

A.  The saved report format is a proprietary metafile format that is only readable by QuickReport.

------------------

Q.  Why can't I load reports saved from the preview into the Editor and vice versa?

A.  The .QRP files saved by the preview are a rendered copy of the report saved as a metafile (not WMF format).  You can only preview or print a .QRP file.  The .QR file saved by the Editor is a Delphi resource file like a .DFM file and is basicly a report form.  It contains the information required to run a report, but it does not have any data from the report in it,

------------------

Q.  I am trying to do is distribute .qrp files to our sales force.  On their end I will associate .qrp with a viewer we create.  If I create the .qrp file here where my default printer is a laserjet and distribute the report to someone who has a canon?

A.  You can, but if the page sizes are different the page will be stretched (or compressed) to fit the page and there may some loss in resolution.  An alternative way of doing this would be to use Adobe Acrobat and print the files as PDF files.  The files would be more compact and Adobe makes the Acrobat Reader program freely available for multiple platforms.

------------------

 

[Text controls]

==================

Q.  The OnPrint event of my TQRLabel control is never being called.

A.  Is the caption of the label blank?  The code checks the caption and if it's blank, it doesn't call the OnPrint event to save time.  If you want to use OnPrint with a TQRLabel, you must set the Caption to a non empty string.

------------------

Q.  I have controls on the page footer that use the detail table.  On the each page of a report (except for the last page) the first record's data appears everywhere except in the page footer where the second record's data appears.

A.  When the page footer band is printed, the report is already working on the first detail record for the next page.  One way around this would be to use the AfterPrint event of the detail band to store the data for the page footer band in some variables.  In the BeforePrint event of the footerband, you would use TQRLabels and set the their captions to the string representations of the variables.

------------------

Q.  On a band, I have some QRDBText fields and a QRMemo field (set to autostretch=true).  When the memo field is going to go beyond the current page - QR prints the memo first (instead of the text fields) and then rolls on to the new page, finishes the memo, and then prints the text fields on top of the next page.  How can I force the QRDBText fields to print first?.

A.  The memo control is being printed first, which causes the page break and the rest of the controls are printed afterwards.  If you change the creation order of the controls on the band so that the memo is last, the other controls will print first.  Select each control (except for the Memo) and right-click on each one and select "Send to Back".  That will create other controls before memo.

------------------

Q.  I can't get my text to word wrap if it doesn't have any carriage returns in the text?

A.  Check to make sure that your text has spaces in it.  If the text is unbroken, it will not be word wrapped.

------------------

Q.  My RTF text does not have the same formatting as it appears in MS Word.

A.  QuickReport's RichText control uses Delphi's RichEdit control, which in turn is a wrapper for Microsoft's RichEdit common control.  And that control may not be able to handle your file.  Almost all of our RTF problems have been traced to bugs in that common control, and it ripples down to our control.  If you load your rtf file into WordPad and it looses the formatting, then you can trace it to the common control. 

------------------

Q.  I can't get the mask property work with my phone number field (it's a string field)

A.  The mask property only applies to numeric fields and will be ignored on string data.  Use the OnPrint event to format the field like the following:

procedure TfrmReport.QRDBTextPhonePrint(sender: TObject; var Value: string);

begin

  Value := '(' + copy(Value,1,3) + '' + copy(Value,4,3) 

    + '-' + copy(Value,7,4);

end;

------------------

Q.  If the report contains nulls or blanks these are not included, this destroys the alignment of the columns. Is there any way to include all nulls?

A.  Use a QRExpr control for fields that could have nulls and for the expression use the IF() function to insert a space for null fields like the following:

IF(tbSample.Extra<>'', tbSample.Extra, ' ')

------------------

Q.  My multiple line QRDBText controls are having the words cutoff at the right margin even when autosize is set to false.

A.  If you have autostretch turned on, please make sure that the WordWrap is also turned on.

------------------

Q.  I can't get the mask property to work on my numbers.

A.  Please make sure that you are using a number field, the mask property will be ignored for string fields.

------------------

Q.  I read the FAQ to use TQRDBText because there is no TQRDBMemo, but when my memo contains embedded carriage returns they show up as a square symbol, not as a new line.

A.  This was a known bug and it was fixed in the 2.0j release.

------------------

Q.  Is there a property for QRDBText to tell it *not* to split itself across pages? (i.e. widow/orphan protection.)

A.  Support for a "widow/orphan" feature will part of the 3.0 release, due out early next year.

You can provide some of it's functionality with the current release with some minor coding.

First, add the following declarations to the under private in your report form declaration:

  TfrmReport = class(TForm)

  [extra deleted]

  private

    { Private declarations }

    function GetQRAvailableSpace: integer;

    property QRAvailableSpace: integer read GetQRAvailableSpace;

 

Then define the function:

function TfrmReport.GetQRAvailableSpace: integer;

begin

  with QuickRep1 do

    if Page.Orientation = poPortrait then

      result := round(QRPrinter.PaperLength - Page.BottomMargin - PageFooterBand1.Size.Length - CurrentY)

    else

      result := round(QRPrinter.PaperWidth - Page.BottomMargin - PageFooterBand1.Size.Length - CurrentY);

end;

This assumes a footer band with no child bands.  To see how to check child band size, see the actual availablespace function in the quickrpt unit.

 

To use this function to prevent a group band from being orphaned, call it from the BeforePrint event of the group band like the following:

procedure TfrmQRProd.QRGroupCustomerBeforePrint(Sender: TQRCustomBand;

  var PrintBand: Boolean);

begin

  { Set your PrintBand code here if needed }

  if PrintBand then

  begin

    // Force a new page if not enough room for next detail band

    if QRAvailableSpace < round(Sender.Size.Length + QRGroupCustomer.Size.Length + DetailBand1.Size.Length) then

      Sender.ParentReport.NewColumn;

  end;

end;

 

This will force a new page if there is not enough room for a detail band after the group band.

Please note that will not work with bands with stretching controls as we do not know the length of the band at the time of the BeforePrint event.

------------------

Q.  What about adding real "LeftAndRightJustify" (newspaper style) (aka Full Justification) in an upcoming release?

A.  This will not be part of QuickReport.  A future release will make the FormatLines procedure virtual so this can be done in a descending component by someone else.

------------------

Q.  How do I control interline spacing within a QRMemo?  Sometimes I need greater control over the line spacing.

A.  This will be part of the 2.1 release

------------------

Q.        When a TQRDBText field is added to a pageheader band the field is not refreshed (it remains the last field printed).

A.  This is not a bug, the report is designed to retreive rows from the dataset when it handles the detail band, it's not designed to refresh the dataset at the first call for the PageHeader.  There is a simple way to get the correct for what you want to do.  In the BeforePrint event of the report, add a line that goes to the first row of the dataset.  If you are using a TTable named "Table1" it would look like this:

procedure TfrmSample.QuickRep1BeforePrint(Sender: TQuickRep;

  var PrintReport: Boolean);

begin

  Table1.First;

end;

------------------

Q.  I put a mask 999\-999\-9999 for a phone number. And it still printing 5144559400 instead of 514-455-9400. Why?

A.  That is the format of the editmask used by the TMaskedEdit control. The QRExpr control's mask is the format string used by FormatFloat() and FormatDateTime functions.  Please refer to their documentation for allowable values.  In this case, the format mask for the USA phone number would '(000) 000-000'

Documented on page 2-32 in the manual.

------------------

Q.  I have two autostretched text controls on one band and it doesn't work right.

A.  Multiple stretching controls on one band is not supported.  This is documented on the manual page for the AutoStretch property.  This limitation was removed in the 3.0 release.

------------------

Q.  I have a calculated table field and it has line breaks in the text and those line breaks don't print.

A.  Delphi defines calculated table text fields as TStringfield and QR handles that type of field differently than

    it handles actual memo fields.  To output a calculated text field, use a QRMemo component and set QRMemo.Lines.Text to the

 the value of the calculated field at runtime.

------------------

Q.  I am setting QuickRep1.QRPrinter.OnGenerateToPrinter:=nil to expedite the printing of a large report from the preview form.  When I use the printersetup to select a subset of the pages for printing, I still get all of the pages printed. When I don't set OnGenerateToPrinter:=nil, the settings take effect and I get the subset of pages printed. How can I print a subset of the pages and still use OnGenerateToPrinter:=nil to expedite printing?

A.  This is a known limitation (also applies to saved reports) and will be addressed in a future release.  The only work around would be to only set the OnGenerateToPrinter to nil when you know that the printer setup button has not been pressed.  Starting with the 2.0j release, if you use a custom preview, you can check the result of calling printersetup and then you could set the OnGenerateToPrinter to nil if the user did not use printersetup.

------------------

Q.  Is there a simple way to use a single QRLabel and create a label with the letters stacked on top of each other.  An example is shown below.

P

A

T

I

E

N

T

A.  With QR 2.0J you can insert carriage returns and line feeds between each letter and set the Stretch property of the control to true. 

Example:

qrlabel1.Caption :=   'V' + #13#10 + 'E' + #13#10 + 'R' + #13#10 + 'T' + #13#10 + 'I' + #13#10 + 'C' + #13#10 + 'A' + #13#10 + 'L';

------------------

Q.  I need to change the DataField properties on the QRDBText component under run-time so that it uses one field on page 1 and another the rest of the pages.

A.  You can not change the DataField property after the report starts.  You could use a TQRLabel control and set it's value at runtime in (either in it's OnPrint event or it's parent band's BeforePrint event) based on the current value of the report's PageNumber property.

------------------

Q.  If I use tabs (ctrl-tab in the editor) in my TQrMemo fields the report prints []. Is that a general problem in TQrMemo fields?

A.  Tab characters are not supported in the TQRMemo, TQRLabel, TQRExpr, TQRDBtext controls.  The only control that will correctly display a tab character are the RichText controls.

------------------

Q.  Is it possible to change the Autosize property of the QRImage and the Autostretch property of the QRRichtext at runtime ?

A.  Yes, you can change most of the properties at runtime in the BeforePrint and AfterPrint events of the report and of the band that the controls are on.

------------------

Q.  Can you advise me how to suppress the printing of blank fields in mailing label report?

A.  Use a TQRMemo control and fill it with only the information that is not blank.

Example:

 

procedure TReportForm.AddIfNotBlank(memo: TQRMemo; s: string);

begin

  { simple function to only add non blank fields }

  if Trim(s) <> '' then memo.Lines.Add(s);

end;

 

procedure TReportForm.DetailBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);

begin

  QRMemo1.Lines.Clear;

  QRMemo1.Lines.Add(Table1Company.AsString);

 

  AddIfNotBlank(QRMemo1, Table1Addr1.AsString);

  AddIfNotBlank(QRMemo1, Table1Addr2.AsString);

  AddIfNotBlank(QRMemo1, Table1City.AsString + ', ' +  Table1State.AsString + '  ' + Table1Zip.AsString);

end;

------------------