发信人: wpf (Itouchthebluesky), 信区: BorlandDev
标 题: quickreport q/a 3
发信站: 哈工大紫丁香 (2001年06月09日20:08:11 星期六), 站内信件
Q. I want to make a report with 2 subdetails. The first subdetail works fin
e, 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 column
s applies to all detail and subdetail bands. One work around is to put thre
e sets of TQRLabels on your second subdetail band and manually handle the co
lumns. In the BeforePrint event of the band, you would populate the first s
et 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 tim
e 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 re
cords. How can I speed that up?
A. Using the OnFilterRecord event is not very efficient when used with Quic
kReport. Not only is it slow with the preview, but printing from the previe
w would cause the filterevent to hit for every record again. It would be fas
ter to use a TQuery component and filter the data with the SQL statement. I
f that is not possible, create a temporary table and populate it with the da
ta 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 U
nit 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++Buil
der to another to be very problematic if the report is not on a form. Havin
g 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 (e
xample: qrpt40.bpl) package with the other runtime packages, otherwise no ad
ditional files are needed specifically for QuickReport.
------------------
Q. I get access violations with QuickReport 3 when I call the preview repea
tedly
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 Prev
iew. This will allow each preview to close down properly before the next on
e starts.
------------------
Q. My reports do not print when they are run under NT's Scheduler (AT comma
nd) or as a service (TServiceApplication).
A. From Microsoft's Knowledge base article Q152451 (http://support.microsof
t.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 length
y work around listed.
------------------
Q. I get an access violation when I close the report's dataset in the repor
t's AfterPreview event.
A. You can not close (or free) the report or it's dataset in this event. Y
ou 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 OnCli
ck 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, b
ut you can create reports with some work. We have example reports on our do
wnload page that show two methods of writing a crosstab report. The crossta
b.zip file contains a crosstab report built using an array. The CUBE_RPT.ZI
P 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 probabl
y not allocating enough characters for the path to the Windows temp director
y. This has been addressed for QR 3.0.5. For QR2, you can replace the func
tion 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 fals
e.
------------------
Q. What is the most precise way to set the position or size of a QuickRepor
t 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 rep
ort 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://ww
w.adobe.com/supportservice/custsupport/SOLUTIONS/10a6a.htm
------------------
Q. I have defined a message that I use to terminate my application. Whenev
er 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 info
rmation 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 s
o 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 abs
olute 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 p
rint some static text.
A. One way to do this would be to use a ColumnHeader band and use the Befor
ePrint and AfterPrint events of that band to control the printing. If you a
re 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 numbe
red 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 be
en 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 f
ine with QuickReport 2 and 3. The general rule of thumb is that if the regu
lar Delphi data aware controls work with your 3rd party TDataset, then Quick
Report will work too. The release of QR3 bundled with Delphi 4 would not wo
rk 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 us
ing 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 wit
h 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 w
ould 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, th
e 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 Intell
imouse 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 som
e common questions. This file is basically the most common questions (and s
ome 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 ma
nually 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 o
f 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 proper
ty 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 (tw
o 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 k
eep that together?
A. Right-click on the image controls and select "send to back". This put t
he images at the top of the creation order on the band and they will be prin
ted first, forcing a page break if needed.
------------------
Q. I want a 1.5" top margin and 0.5" bottom margin on odd numbered pages a
nd 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 arou
nd would be use Childbands on the page header and page footer bands and sele
ctively print the Childbands on every other page. First set the top and bot
tom margins to 0.5".
For the footer band, you add a blank child band of 1" in height. In that ba
nd's BeforePrint event, you would set PrintBand to true only on even numbere
d 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 ban
d 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 numbere
d pages. This will give the appearance of increasing the top margin by 1" o
n the odd number pages.
------------------
Q. How can I set the contents of the page header based on the first subdeta
il band that prints on that page?
A. You could do this by using Childbands on the page header. Use group foo
ter 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 globa
l variable to a value that would represent the next subdetail band. When th
e it comes time to output the child bands on the pageheader, you would set t
heir PrintBand variable in their BeforePrint event based on the value of tha
t 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. Yo
u would not want to increment the value by 1 each time, that would get out o
f 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 floa
ting point operation".
A. There is a known problem with QR2 if you change the orientation at runti
me 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 prev
iew reports that use QRDBText controls with MEMO fields.
A. It has been reported to use that if you have the Apollo driver configure
d so that the BDE can also be used, you can get this problem. Setting the Ap
ollo driver so that it's the only driver has been reported to fix this probl
em.
------------------
Q. Every time I preview a report, I lose memory.
A. There are a few things that could cause this. Older versions of QuickRe
port 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 d
rivers. This is a problem with the printer driver, not with Quick Report. I
f you are using one of these drivers, you should get the latest driver for y
our printer from HP's web site (http://www.hp.com/cposupport/jsnav/prhome.ht
ml). 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 cau
sing the problem.
------------------
--
据说呆娃儿不笨
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.245.166]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:215.604毫秒