forcing a subreport created in code to start on a new page
I am adding a subreport created in code to an existing report. I want the
subreport to appear on a new page that has a different orientation to the
first report page. I.e. the first page is A4 portrait, the second page is A4
landscape. Setting the NewPage property of the generated title band has no
effect, the subreport always prints on the first page.
My code looks like:
//--------------------------
// Create dynamic sub report
//--------------------------
dynSubReport := TppSubReport.Create(Self);
dynSubReport.Band := ppReportRC01.DetailBand;
dynSubReport.ParentPrinterSetup := False;
dynSubReport.CreateReport(ppReportRC01);
//----------------------------
// Create dynamic child report
//----------------------------
dynChildReport := TppChildReport(dynSubReport.Report);
dynChildReport.DataPipeline := ppJITPipelineMV;
dynChildReport.Units := utMMThousandths;
dynChildReport.NoDataBehaviors := [ndBlankReport];
dynChildReport.PrinterSetup.BinName := 'default';
dynChildReport.PrinterSetup.PrinterName := 'default';
dynChildReport.PrinterSetup.PaperName := 'A4';
dynChildReport.PrinterSetup.Orientation := poLandscape;
dynChildReport.CreateDefaultBands;
dynChildReport.TitleBand.Height := 11000.0;
dynChildReport.TitleBand.NewPage := True;
//----------------------
// Create column headers
//----------------------
y := 0.0;
x := 50000.0;
for col := 0 to (StringListIngot.Count - 1) do
begin
dynName := Format('dynLabelIngot%d', [labelCount]);
MVCreateDynamicLabel(dynName, StringListIngot[col], dynChildReport,
rbTitleBand, x, y, width);
x := x + width + 1000.0;
Inc(labelCount);
end;
Cheers,
Bruce Taylor
subreport to appear on a new page that has a different orientation to the
first report page. I.e. the first page is A4 portrait, the second page is A4
landscape. Setting the NewPage property of the generated title band has no
effect, the subreport always prints on the first page.
My code looks like:
//--------------------------
// Create dynamic sub report
//--------------------------
dynSubReport := TppSubReport.Create(Self);
dynSubReport.Band := ppReportRC01.DetailBand;
dynSubReport.ParentPrinterSetup := False;
dynSubReport.CreateReport(ppReportRC01);
//----------------------------
// Create dynamic child report
//----------------------------
dynChildReport := TppChildReport(dynSubReport.Report);
dynChildReport.DataPipeline := ppJITPipelineMV;
dynChildReport.Units := utMMThousandths;
dynChildReport.NoDataBehaviors := [ndBlankReport];
dynChildReport.PrinterSetup.BinName := 'default';
dynChildReport.PrinterSetup.PrinterName := 'default';
dynChildReport.PrinterSetup.PaperName := 'A4';
dynChildReport.PrinterSetup.Orientation := poLandscape;
dynChildReport.CreateDefaultBands;
dynChildReport.TitleBand.Height := 11000.0;
dynChildReport.TitleBand.NewPage := True;
//----------------------
// Create column headers
//----------------------
y := 0.0;
x := 50000.0;
for col := 0 to (StringListIngot.Count - 1) do
begin
dynName := Format('dynLabelIngot%d', [labelCount]);
MVCreateDynamicLabel(dynName, StringListIngot[col], dynChildReport,
rbTitleBand, x, y, width);
x := x + width + 1000.0;
Inc(labelCount);
end;
Cheers,
Bruce Taylor
This discussion has been closed.
Comments
Try setting your SubReport.PrintBehavior := pbSection. This will by default
start the subreport on a new page.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com