发信人: wpf (Itouchthebluesky), 信区: BorlandDev
标 题: quickreport q/a 4
发信站: 哈工大紫丁香 (2001年06月09日20:08:57 星期六), 站内信件
Q. How do I do a title page?
A. For single column reports add a title band and call the report's NewColu
mn method from the title band's AfterPrint event.
A. For multiple column reports, add a title band and set it's height so tha
t 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.Heig
ht;
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 i
s limited by the amount of free disk space, however disk usage can be signif
icantly reduced by enabling QuickReport's internal compression.
-----------
Q. There is a mention of qrsPageCount and QuickReport.Options.TwoPass in th
e 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 repo
rt 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 an
d set the report's PrintIfEmpty property to True.
------------------
Q. I define multiple TQRlabels on a page. I can not find the end of the qr
label.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 hav
e set the caption properties.
------------------
Q. Quickreport seems to leave a trail of files of the form QRPDxxx.TMP in t
he windows temp directory. Is this a result of normal operation, crash or a
borted preview?
A. These files are created when you preview a report and are deleted when t
he 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 QuickRepor
t 3 with custom previews designed with Quick Report 2, there were changes ma
de to how the preview's FormClose event works. Please see the standard prev
iew's FormClose code. If you use the Quick Report 2 Preview's FormClose cod
e, 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 r
uns 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. T
ry 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 b
ottom 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 ban
d, 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 inser
t the RTF codes to the text effect. If you are not familiar with the RTF fo
rmat 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 th
e report from Delphi?
A. Any code that you put in an event handler will only be executed at runti
me.
------------------
Q. I have a report with just a page header and a title band. The title ban
d 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 b
ottom of the page. What is wrong?
A. The report will not work properly without a detail band. It was designe
d 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 co
mpliant. This is applicable for all versions of QuickReport.
All date and time calculations in QuickReport are done using TDateTime field
s. If the data supplied to the QuickReport is Y2K compliant, then the calcul
ations 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 us
e the default values supplied by Delphi from Windows.
Please be aware that QuickReport is a software development tool. QuSoft cann
ot control the ultimate quality or accuracy of products developed using Quic
kReport. Therefore, QuSoft provides no warranty whatsoever in connection wit
h Year 2000 readiness of any software developed by third parties using Quick
Report.
Additional information about Delphi Y2K compliance can be found at http://ww
w.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 m
ust 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 informa
tion on that.
An alternative means would be to use the ASCII export filter to send the rep
ort to a text file and then copy that file to the printer. To set any print
er and/or font properties, you would have to edit the text file and insert t
he characters or use a similar method.
------------------
[Multiple Columns]
==================
Q. Is it possible to set the width of each column if the page has 4 columns
?
A. The width of the column is the determined by the number of columns divid
ed by the page width, then subtract the report.page.columnwidth value. You
can not set the width of a band directly.
------------------
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 pag
eheader 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 an
d use the preceding page header (and children) for the title information. I
n the BeforePrint events for the bands, you would set PrintBand to false wh
en 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 tha
t forces a page break, and one that forces a column break. I can set this j
ust 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 suppress 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 t
o true to handle the reset of the page. Set the property to false in the re
port's OnStartPage event, which gets called at the start of each page. In t
he AfterPrint event of the group band, set the property to True so it will w
ork 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 heigh
t or Size.Height properties to fit the height of your labels and then set th
e report's Page.Columns property to the number of labels that would go acros
s the page. You may need to adjust the top and bottom margins of the page t
o fit your labels.
------------------
Q. Is there a way to make QReports print columns Left to Right - Top to Bot
tom instead of Top to Bottom - Left to Right?
A. This is scheduled for a future QuickReport release. One work around wou
ld be to use multiple sets of TQRLabel controls on a single column detail ba
nd. You would call the report's dataset.next method in the detailband's Bef
orePrint event and assign the values to the TQRLabels.
------------------
Q. When I do a multiple column report, the detail bands print on the same l
ine as the group bands
A. Group bands are the same width as the detail bands and since the columns
go down then across, it is possible to have detail bands at the same vertic
al position (different horizontal position) as group band. If you want colu
mn 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 ha
ve a detail band. I get an exception in the TQRCustomBand.GetBandSize funct
ion when I try to run the report.
A. You must have a detail band for multiple column reports. This is a know
n bug and will be addressed in a future release. If your report does not re
quire a detail band, then just set it's height to 0.
------------------
[NeedData]
==========
Q. How can I update the progress display when I use OnNeedData to populate
the report?
A. You can set the report's QRPrinter.Progress property in the report's OnN
eedData event. The value should be in the range of 1 to 100.
Example: QuickRep1.QRPrinter.Progress := (Longint(CurrentIndex) * 100) div M
yTotalCount;
------------------
Q. How do I use the OnNeedData event?
A. When you define this event, it will get called to see if a new detail li
ne is needed. It has a boolean variable named MoreData. Set it to true if
you still have data and false when you are done. The QR3DEMO project on our
download page has examples of how to use this.
------------------
Q. I am using the onNeedData event to fill a report, and I noticed that the
last "record" doesn't show on the preview, and it doesn't print.
A. In your OnNeedData event, are you setting MoreData to false on the last
record? That would suppress the last record, you want to set MoreData to fa
lse in the OnNeedData event that gets called after the last detail band has
printed.
------------------
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 da
ta from other sources via the OnNeedData events. Please see the manual topi
c for OnNeedData for more information.
------------------
Q. The output from preview is correct, but printing from the preview does n
ot print all of the data or the data has values from the last run of the rep
ort.
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 gen
erated.
When the report is regenerated, sometimes you will have to reset your datase
t. 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 cach
ing.
Another situation would be if you are using OnNeedData and that event is con
trolled by a variable that needs to be initialized at the start of the repor
t.
------------------
[Paper size issues]
==================
Q. If the Quickreport.Page.TopMargin is to small then the Top of the Quic
kreport is not be printed. Quickreport should tell the user that the Quickr
eport 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 t
he 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 defa
ult.
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. I create my reports using this method:
QuickReport.Prepare;
QuickReport.QRPrinter.Preview ;
QuickReport.QRPrinter.Free;
QuickReport.QRPrinter := nil;
Now the navigation buttons in the print preview do not work.
A. When used with Prepare, the Preview method returns immediately. This co
de would have freed the data being used by the preview. The Free and Nil li
nes should be removed. If you want the code to wait until after the previe
w has executed, just put a wait loop that waits until the qrprinter has been
freed:
Example:
repeat
Application.ProcessMessages
until QuickRep1.QRPrinter = nil;
--
据说呆娃儿不笨
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.245.166]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:209.463毫秒