Quick Report FAQ [ 2 ]

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
------------------
Q. How do I 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. If that does not work, you can create a Calculated Field in your Dataset that is a combination of the fields and have the group.expression use that field.
------------------
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. Group bands in Quick Report 3 have a ReprintOnNewPage property to do this. With Quick Report 2, 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 1, Group 3, case three Group 4, Group 2 etc. The order is told by end user 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. My images do not print consistently.
A. This can happen for a few reasons. If you are using a TQRDBImage and the images do not always print, it may be a problem with how the BDE is handling the BLOB data.
Instead of using a TQRDBImage, use a TQRImage and a TDBImage. Assign the database bitmap to the TDBImage (you will need to add a TDataSource to assign the field to the TDBImage). In the BeforePrint event of the band that contains the TQRImage, assign the TDBImage's bitmap to the TQRImage's bitmap.
Example:
procedure TfrmImageTest.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
qrimage1.picture.bitmap.assign(DBImage1.Picture.Bitmap);
end;
If you are using a TQRImage and loading the image directly into the component does not work, try loading the image into a TBitmap and then copying the data to the TQRImage component.
Example 1:
MyBitmap.LoadFromFile(somefile); // MyBitmap is a TBitmap that is created and freed somewhere else
QRImage.Picture.Bitmap.Assign(MyBitmap);
Example 2:
MyBitmap.LoadFromFile(somefile);
QRImage.Picture.Bitmap.Height := MyBitmap.Height;
QRImage.Picture.Bitmap.Width := MyBitmap.Width;
QRImage.Picture.Bitmap.Canvas.Draw(0,0, MyBitmap);
------------------
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 depending 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'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.
------------------
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 continuos 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 am having a very frustrating time trying to import Applications designed in Delphi 3 (with QuickReport Pro 3) into Delphi 5. The problem is that so many of the QR units fail to be accepted, the error always being that the unit was 'compiled with a different version of . . .'. How can I fix this?
A. We have a fileset of 3.0.5 specificly compiled for Delphi 5, you can't use the QuickReport fileset from Delphi 3. You should also verify that your project is not pulling in any Delphi 3 directories or files.
------------------
Q. When I start Delphi an entry point not found in delphi32.exe with this error: The procedure entry point @Qrmdsu@initialization$qqrv could not be located in the dynamic link library Qrpt40.bpl.
A. It sounds like a conflict with a previous version. If you have not removed QR305 and got Delphi 4 running again, do that now. If you are not familiar with how to remove packages outside of Delphi, you can do this by deleting a registry key. The QR installer writes an install.log file in the delphi directory. Towards the end of the file, it lists the registry key used to register the package. If you delete that key with regedit, you should be able to restart Delphi 4.
After getting Delphi running again, remove all previous versions of QR from Delphi and try reinstalling 305 again.
We do have the source code only version on our download page if you want to try rebuilding the package manually.
------------------
Q. How can I install the help file?
A. There is a freeware program for installing Delphi help files named 'HelpLinker'. HelpLinker was developed by Scoutship Software. You can download the program from http://www.scoutship.com/helplinker.htm
------------------
Q. Where can I get a list of all of the files that were installed when I ran the QuickReport installation program?
A. Each installer creates or updates a file named install.log in the delphi or c++builder directory. This is a standard log file that the install programs use and will list the files installed and registry keys that were updated.
------------------
Q. (Qr3)I just installed 3.0.5 into Delphi and I get access violations when I add a TQREditor component to a form.
A. If you are using the French or German versions of Delphi, they come with a localized copy of the qrpt40 (or qrpt50, qrpt43, depending on your version of Delphi) package file. You will need to delete qrptXX.fr (or qrptXX.de) file.
------------------
Q. After installation of Quick Report 3.0.4 (Professional) for Delphi 4 on my computer, I started to build a new project. But at compilation I encountered the following error: QRPrev was compiled with a different version of comctrls: TToolBar
A. Have you applied Update Pack 2 (or newer) to your Delphi 4? This is required for QuickReport as of the 3.0.4 release.
------------------
Q. I just installed QR 3 into C++Builder 3 and I can't link the project.
A. Make sure that the project is using qrpt43c as the runtime package instead of the qrtp35 file from QR2. The QR3 installer will not modify your project files, you may have to manually edit the package list and header files used by the project.
------------------
Q. How do I install the latest patch to QuickReport?
A. We do not use patch filesets. Each fileset that we release is the complete version of QuickReport Pro. It is not necessary to apply other QR patches when installing an update. With Delphi 4, we require that you have previously installed Update Pack 2 (or newer) when installing QuickReport 3 Pro. To install QuickReport 3 Pro, you must exit Delphi and any application that used the Delphi runtime packages. If you are using any 3rd party packages that link to QuickReport, you must remove them from the package list before installing QuickReport 3 Pro. After QuickReport 3 Pro has been installed, you can rebuild those packages to link in the updated QuickReport files (Please refer to the documentation and/or tech support for those packages when rebuilding them). After exiting Delphi, just run the QR executable. It will display the warning message about removing TeeChart and Decision Cube and then install the QuickReport 3 Pro package. You can then restart Delphi.
------------------
Q. Do you have any tools that automatically transform files from Delphi 2 and QR1.0 to Delphi 4 and QR3.0 ?
A. We do not have any tools that will do this. One way to convert from QuickReport 1 to new versions of QuickReport is to run two copies of Delphi, each one using one of the QR versions. Start each copy of Delphi with a different version of QuickReport. Load the QR1 report into the copy of Delphi running with the QR1 components and then create a new report in the other copy of Delphi (the one running the newer QuickReport) Cut and paste the components from the QR1 to the new report until you have rebuilt your report.
------------------
Q. I installed QuickReport 3 and I can't load the dclqpro package.
A. The dclqpro package is a QuickReport 2 package and can not be used with QuickReport 3. The code in dclqpro is now in the main dclrpt40 (of dclqrpt43) package.
------------------
Q. I can't install QuickReport 3 into Delphi 3. Even after I remove QuickReport 2, I still get the error "TQuickReport class already exists" when I try to add the QuickReport 3 package.
Q. I can't install Quick Report 3, it conflicts with WPTools (or any package that uses Quick Report_.
A. If you have any 3rd party packages that use QuickReport 2 (like TeeChart 3), they will implicitly load the QuickReport 2 runtime package when Delphi loads. You will need to remove that package or packages before installing QuickReport 3. After installing QuickReport 3, you can go back and rebuild the packages that used QuickReport 2. You will need to edit the .dpk file for the package and replace any reference of qrp30 to qrpt43.
1. Remove the package or packages that use QuickReport 2 from the package list. You must completely remove the package from the list, disabling it will not be enough.
2. Remove the QuickReport 2 packages, DCLQRT30.DPL and DCLQRPRO.DPL
3. Install Quick Report 3
4. Locate and open the package file (.dpk) for the each package. The name and location of the file will vary. Some of then may be in the Delphi lib directory, some vendors place them in a separate directory. If you click on the package in the package list dialog, it should display the name of the directory where the package file is. The .dpk file should be in the same directory. You can also use the Windows File Find to locate all of the .dpk files on you machine.
5. Look for any reference to qrpt30 in the requires list in the .dpk file. This is the Quick Report 2 file. Remove it and recompile the package. It should find the QuickReport 3 file, qrpt40 (qprt43 for Delphi 3). If it doesn't find it or tries to use qrpt30, you will need to manually edit that line and add the QuickReport 3 file.
6. Rebuild the package.
In your Delphi bin directory, you can execute the following DOS command line to get a list of packages that use QuickReport 2
for %x in (*.dpl;*.bpl) do find /I /C "qrpt3" %x
This will list the name of each package and the number of times that the text qrpt3 occurs in that file. If you have 3rd party packages that are installed to a different directory, you can run that command there.
------------------
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.0directory.
------------------
Q. Recently I upgraded Delphi 3 to Delphi 3.02. I now get an error trying to install QuickReport 2 Pro package.
Error Message comes back as: Can't load package c:.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.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 2 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 was not in Quick Report 2, but returned in Quick Report 3
------------------
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. 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.0, all 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 "...3" 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, 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 time outs 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.
------------------
Q. I tried to download a file from your web site 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 included with Quick Report 2. You'll need to install that unit to get that control. Quick Report 3 Pro does not have a qrbonus file and it installs TQRExprMemo when you install the package.
------------------
Q. I have removed QuickReport 2 Pro 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.txt file without missing a step.
------------------
[Master/Detail reports]
==================
Q. How do you do multiple subdetail bands at the same level?
A. You would use multiple subdetail bands, one for each child table. The master property of each subdetail would be set to the report.
------------------
Q. Is there any way to print the set of subdetail bands before the detail band?
A. Set the subdetail band's PrintBefore property to true and it will print before the detail band.
------------------
Q. My master/detail reports do not print any of the detail records.
A. There are a few things to check. Make sure that the subdetail's dataset property is set to the correct dataset. Make sure the subdetail band's dataset (the detail) is linked to the dataset of the report (the master). With TTables, this is done through the MasterSource and MasterFields properties. With the TQuery component, you would have set Params properties. Also check to see if you are setting the DisableControls property of the master dataset, this will disable master/detail relationships.
------------------
Q. I would like to know if it is possible to include subreports into reports like Microsoft Access.
A. QuickReport 2 has a similar feature with the TQRSubDetail band. This is documented in the manual and help files. Additional information can be found in this section of the Knowledge Base. A Master/detail tutorial project is available on our download page.
(QR3) The QR3DEMO project on our download page includes a couple of master/detail reports.
------------------
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 independent of any other band. In this 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 columns 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. The recordcount is very slow in Delphi if there is OnFilterRecord event connected because all the dataset will be scanned to return the number of records. How can I speed that up?
A. Using the OnFilterRecord event is not very efficient when used with QuickReport. Not only is it slow with the preview, but printing from the preview would cause the filterevent to hit for every record again. It would be faster to use a TQuery component and filter the data with the SQL statement. If that is not possible, create a temporary table and populate it with the data from the filtered table and have QuickReport use the temporary table. It would preview and print much faster than a table that uses a filter.
------------------
Q. If I change the size-property in the Objectinspector, the size has the Unit in MM. If I change the size in the BeforePr韓t-Event the Unit seems 1/10 MM, so I must multiply my Value's by 10. Is this an error?
A. At runtime, the report switches to native units, which are in 1/10 mm. We switch the units to native so we can be as precise as possible.
------------------
Q. Is there any difference between having a report on a form or by itself?
A. We have found that porting reports from one version of Delphi or C++Builder to another to be very problematic if the report is not on a form. Having a report on a form is more flexible because you can use the form's Create/Destroy events to create and free accessory datastructures.
------------------
Q. What files are needed to deploy applications using QuickReport?
A. If you are using runtime package, you need to include the QuickReport (example: qrpt40.bpl) package with the other runtime packages, otherwise no additional files are needed specifically for QuickReport.
------------------
Q. I get access violations with QuickReport 3 when I call the preview repeatedly
A. This is an open issue that we are still working on. The work around is to call Application.ProcessMessages either before or after each call to Preview. This will allow each preview to close down properly before the next one starts.
------------------
Q. My reports do not print when they are run under NT's Scheduler (AT command) or as a service (TServiceApplication).
A. From Microsoft's Knowledge base article Q152451 (http://support.microsoft.com/support/kb/articles/Q152/4/51.asp) : Printing fails because no default print device is defined for the service account. This article has a lengthy work around listed.
------------------
Q. I get an access violation when I close the report's dataset in the report's AfterPreview event.
A. You can not close (or free) the report or it's dataset in this event. You would do that type of code after the call to Preview returns.
------------------
Q. Is it possible to have a QR DBText,QRLabel, or QRSubdetail with an OnClick event? When I'm previewing a report I would like to Click on something (band,field,label, etc) to launch another report.
A. This functionality does not exist in QuickReport 3, but this is planned for QuickReport 5 due out later this year.
------------------
Q. How do I create crosstab or pivot reports with QuickReport?
A. QuickReport does not have crosstab (aka pivot table) support built in, but you can create reports with some work. We have example reports on our download page that show two methods of writing a crosstab report. The crosstab.zip file contains a crosstab report built using an array. The CUBE_RPT.ZIP file contains a report that prints the data displayed in a Decision Cube.
------------------
Q. My report crashes under Windows 2000 and/or Windows NT
A. In qrprntr.pas, there is a function named TempFileName and it is probably not allocating enough characters for the path to the Windows temp directory. This has been addressed for QR 3.0.5. For QR2, you can replace the function with the following code:
function TempFilename : string;
var
AName,
ADir : array[0..255] of char;
begin
GetTempPath(255, adir);
GetTempFilename(aDir, PChar('QRP'), 0, aName);
result := StrPas(aName);
end;
------------------
Q. My customer's PC is set to use "Large Fonts" for the display font size. This changes the layout and size of my report controls.
A. Delphi will scale the components if you have the form's Scaling property set to True. With QuickReport, you should always set this property to false.
------------------
Q. What is the most precise way to set the position or size of a QuickReport component on a band?
A. If you set the report units to Native, the component's Size properties (Size.Length, Size.Left, etc) will be measured in 1/10 of a mm. When the report runs, we switch the units to native so we can be as precise as possible.
------------------
Q. I want to print my reports to Adobe Acrobat PDF files. Is there any way to bypass the file dialog box and pass in a file name to save the PDF file as?
A. Adobe has a technical document that explains how to do this at http://www.adobe.com/supportservice/custsupport/SOLUTIONS/10a6a.htm
------------------
Q. I have defined a message that I use to terminate my application. Whenever I run the Quick Report 3 preview, it calls that message.
A. Quick Report 2 and 3 define a small set of messages in the qrprntr unit. If your message number overlaps that list, it will cause a conflict.
------------------
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 am 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 controls 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 header 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 trying 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 Quickreport 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 data aware 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 design time.
------------------
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.TXT?
A. QR2FAQ.TXT was intended to list the current release notes along with some common questions. This file is basically 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 1" on 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 1" and 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 floating point 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 will 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. Every time I preview a report, I lose memory.
A. There are a few 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 bottom 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 populate 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 directory prints 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'm 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 behavior, 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 2, if 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 these features have not completed. Please see the question titled "How can I determine the number of pages in my report before I preview or print it?" for a work around.
-----------
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. Quickreport 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. If you call the Prepare method and do not free the QRPrinter object and set it to nil, it can leave a QR*.tmp file behind. If you are using QuickReport 3 with custom previews designed with Quick Report 2, there were changes made to how the preview's FormClose event works. Please see the standard preview's FormClose code. If you use the Quick Report 2 Preview's FormClose code, it will not free the qrprntr object created by the report.
------------------
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 matrix mode is too slow, so I'd 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 environment...
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 similar method.
------------------
 

Similar threads

A
回复
0
查看
844
Andreas Hausladen
A
A
回复
0
查看
723
Andreas Hausladen
A
I
回复
0
查看
1K
import
I
I
回复
0
查看
2K
import
I
顶部