Duplex Printing - Also posted to Tech Tips by mistake
I am tearing my hair out trying to produce a report for use on a duplex
printer. The report is an Assembly List which is produced by our Production
Control department and sent to the Factory. It is usually in excess of 100
pages and relates to multiple contracts, each contract is considered as a
separate report and needs to start on an odd page. The Application that
fires the report is written in BCB by a third party and exposes RBs runtime
environment, I cannot therefore write any Delphi Code to directly interact
with report, which leaves me with RAP.
My question is: Ho can I consistently ensure that each of the 'Reports'
begins on an odd page, padding out any even pages as necessary?
Currently I am using the following code:
Procedure GroupFooterBand6BeforePrint;
begin
If (Report.PageNo = Report.PageCount) Then
begin
If Not IsOdd(Report.PageNo) Then
begin
GroupFooterBand6.PrintPosition := 0;
GroupFooterBand6.Visible := False;
end
else
begin
GroupFooterBand6.PrintPosition := 1;
GroupFooterBand6.Visible := True;
end;
end;
end;
The Group Footer contanins a Region containing a 'This page is Intentionally
Blank' image.
printer. The report is an Assembly List which is produced by our Production
Control department and sent to the Factory. It is usually in excess of 100
pages and relates to multiple contracts, each contract is considered as a
separate report and needs to start on an odd page. The Application that
fires the report is written in BCB by a third party and exposes RBs runtime
environment, I cannot therefore write any Delphi Code to directly interact
with report, which leaves me with RAP.
My question is: Ho can I consistently ensure that each of the 'Reports'
begins on an odd page, padding out any even pages as necessary?
Currently I am using the following code:
Procedure GroupFooterBand6BeforePrint;
begin
If (Report.PageNo = Report.PageCount) Then
begin
If Not IsOdd(Report.PageNo) Then
begin
GroupFooterBand6.PrintPosition := 0;
GroupFooterBand6.Visible := False;
end
else
begin
GroupFooterBand6.PrintPosition := 1;
GroupFooterBand6.Visible := True;
end;
end;
end;
The Group Footer contanins a Region containing a 'This page is Intentionally
Blank' image.
This discussion has been closed.
Comments
global variable and a global OnCreate event in RAP for the FPrintingSpacer
Delphi variable as used in the article:
------------------------------------------------------
Article: Forcing Group Headers to Start on Odd Pages
------------------------------------------------------
Question:
I have a report that is printing duplexed
and therefore I want to force the group headers to
start on odd pages.
Solution:
Using demo report #71 do the following:
1. Add a subreport to the GroupFooter band, just below the existing
controls.
2. Set the subreport's PrintBehavior property to pbSection - do not add any
controls to the subreport - leave it blank.
3. Add a Private field to the form: FPrintingSpacer: Boolean.
4. Add an event handler for the FormCreate event with the following code:
FPrintingSpacer := False;
5. Add an event handler for the ppOrderDetailGroupFooterBand1BeforePrint
event with the following code:
if not FPrintingSpacer then
begin
ppSubReport1.Visible := odd(ppOrderDetail.AbsolutePageNo) and
not ppOrderDetailGroupFooterBand1.Overflow;
FPrintingSpacer := ppSubReport1.Visible;
end
else
FPrintingSpacer := False;
6. Run the project and view report #71.
Note that when a group is to start, it will only start on an odd page.
Caveats: We are brute-forcing this solution by causing the even numbered
page to be taken up by the section style subreport. As a result, any page
headers or footers you have in the main report will not appear on the even
pages that are blank. To get around this, you could add identical
header/footers or custom header/footers with only page numbers, or some
such.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
The code I am using is:-
begin
If Not FPrintingSpacer then
begin
subSpacer.Visible := IsOdd(Report.AbsolutePageNo) And Not
GroupFooterBand6.OverFlow;
FPrintingSpacer := subSpacer.Visible;
end
else
FPrintingSpacer := False;
end;
and I have put the subReport (subSpacer) in GroupFooterBand6, however the
report fails to run reporting that it could not run program
GroupFooterBand6.BeforePrint.
If I take out the Not GroupFooterBand6.OverFlow clause the report runs OK
until it shows the sub-report, when it of course throws an infinate number
of pages :-(
I am currently using RB6Pro Demo (until I manage to persuade finance to
purchase the full version ;-) ) and cannot find the demo report #71 you
mention in your reply. Is there any where that I can download this sample
report from so that I can try to work out what I am doing wrong?
Many Thanx.
Paul A Bennett
Programmer/Analyst
Epwin Group
what overflow is because there is no RAP RTTI declared for this property.
There are examples of creating RAP pass through functions in your
installation in the RAP tutorials and also in the RAP help file.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com