Multi-Page report - ReportResidentAssessments.pas (0/1)
I've just updated to RB11 (with Delphi 2007) and it "appears" to have
broken some existing code. I said "appears" because I don't think I
have changed anything beyond opening and closing the report.
I wrote about this back on 1-Feb-2002 and with your help I have had it
working. I based my code on some sample code that you emailed me.
Essentially I have one master table which has 50+ columns (It has the
answers to a survey). There are to many fields to fit on one page. So
I designed a report with 3 subreports. Each sub report represents one
page of the survey and has a subset of the columns.
What I need to have printed is the following:
Survey 1
Page 1 of Survey 1
Page 2 of Survey 1
Page 3 of Survey 1
Survey 2
Page 1 of Survey 2
Page 2 of Survey 2
Page 3 of Survey 2
etc....
Without any special code, what I get is:
Page 1 of Survey 1
Page 1 of Survey 2
Page 2 of Survey 1
Page 2 of Survey 2
Page 3 of Survey 1
Page 3 of Survey 2
My Basic Routine to Print is as Follows:
if dpData.DataSource.DataSet.RecordCount > 0 then
begin
//
// Initialize SubReport Page Counts
//
FFirstReportPageCount := 0;
FSecondReportPageCount := 0;
FThirdReportPageCount := 0;
//
// Generate Report to Cache and Reorder Pages
//
PrintToCache;
ReorderPages;
//
// Now Actually Print The Report
//
if ADest = dtScreen then
begin
{$IFDEF Debug}
CodeSite.SendMsg( 'Printing to Screen' );
{$ENDIF} // Debug
AReport.AllowPrintToFile := False;
AReport.PrinterSetup.Copies := 1;
AReport.PrinterSetup.DocumentName := 'ProCor ' +
rptTitle2.Caption;
AReport.ShowPrintDialog := False;
AReport.TextFileName := '';
AReport.DeviceType := ADest;
AReport.Print;
end
end
I've checked and the subreport page counts are being created
correctly. If I comment out the routines PrintToCache and ReorderPages
then the report prints but not collated the way I need it. If I
comment out only the Routine ReorderPages, the report prints just not
collated the way I need it.
When I use the routines PrintToCache and ReorderPages and print the
report I get no pages in the print preview and an Access Violation
when I close.
I have attached my code.
---
Luke Miller
ResCorSoft, Inc.
"Feliz es el hombre que ha hallado sabiduría,
y el hombre que consigue discernimiento"
broken some existing code. I said "appears" because I don't think I
have changed anything beyond opening and closing the report.
I wrote about this back on 1-Feb-2002 and with your help I have had it
working. I based my code on some sample code that you emailed me.
Essentially I have one master table which has 50+ columns (It has the
answers to a survey). There are to many fields to fit on one page. So
I designed a report with 3 subreports. Each sub report represents one
page of the survey and has a subset of the columns.
What I need to have printed is the following:
Survey 1
Page 1 of Survey 1
Page 2 of Survey 1
Page 3 of Survey 1
Survey 2
Page 1 of Survey 2
Page 2 of Survey 2
Page 3 of Survey 2
etc....
Without any special code, what I get is:
Page 1 of Survey 1
Page 1 of Survey 2
Page 2 of Survey 1
Page 2 of Survey 2
Page 3 of Survey 1
Page 3 of Survey 2
My Basic Routine to Print is as Follows:
if dpData.DataSource.DataSet.RecordCount > 0 then
begin
//
// Initialize SubReport Page Counts
//
FFirstReportPageCount := 0;
FSecondReportPageCount := 0;
FThirdReportPageCount := 0;
//
// Generate Report to Cache and Reorder Pages
//
PrintToCache;
ReorderPages;
//
// Now Actually Print The Report
//
if ADest = dtScreen then
begin
{$IFDEF Debug}
CodeSite.SendMsg( 'Printing to Screen' );
{$ENDIF} // Debug
AReport.AllowPrintToFile := False;
AReport.PrinterSetup.Copies := 1;
AReport.PrinterSetup.DocumentName := 'ProCor ' +
rptTitle2.Caption;
AReport.ShowPrintDialog := False;
AReport.TextFileName := '';
AReport.DeviceType := ADest;
AReport.Print;
end
end
I've checked and the subreport page counts are being created
correctly. If I comment out the routines PrintToCache and ReorderPages
then the report prints but not collated the way I need it. If I
comment out only the Routine ReorderPages, the report prints just not
collated the way I need it.
When I use the routines PrintToCache and ReorderPages and print the
report I get no pages in the print preview and an Access Violation
when I close.
I have attached my code.
---
Luke Miller
ResCorSoft, Inc.
"Feliz es el hombre que ha hallado sabiduría,
y el hombre que consigue discernimiento"
This discussion has been closed.
Comments
Take a look at the Spreadsheet Style example available from the following
rbWiki article. It uses a very similar method to reorder the pages being
printed and works correctly in RB 11.
http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/How_To...Create_a_Spread_Sheet_Style_Report
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
between RB7 and RB11 so that the code stopped working? Thanks.
On Tue, 14 Oct 2008 09:56:04 -0600, "Nico Cizik \(Digital Metaphors\)"