NewPageThreshold Fails
I've managed to prove I'm not imagining things...
I've a situation where NewPageThreshold is 1.27 inches, remaining space on
page is 0.78 inches, and the band prints anyway.
This is a project where I set NewPageThreshold in "OnBeforePrint" events.
RB 7.04 and D7Ent.
Something is causing the band to completely ignore NewPageThreshold.
I've spent about 15 hours trying various combinations - I can't find a
work-around - looking for suggestions (documented in two previous posts -
happy to provide more info).
EdB
I've a situation where NewPageThreshold is 1.27 inches, remaining space on
page is 0.78 inches, and the band prints anyway.
This is a project where I set NewPageThreshold in "OnBeforePrint" events.
RB 7.04 and D7Ent.
Something is causing the band to completely ignore NewPageThreshold.
I've spent about 15 hours trying various combinations - I can't find a
work-around - looking for suggestions (documented in two previous posts -
happy to provide more info).
EdB
This discussion has been closed.
Comments
NOTE- set in OnBeforeBreak events! Not OnBeforePrint.
EdB
Is this a detail band that is printing? How are you calculating the
remaining space available? If possible, please send a small example in .zip
format demonstrating this behavior perhaps using the DBDEMOS database to
support@digital-metaphors.com and I'll take a look at it for you.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
be printed at the bottom of a page. I'm trying to calculate the threshold at
the BeforeGroupBreak level - is there any way to determine (at
BeforeGroupBreak time) whether the group footer will be needed on the
current page?
EdB
BeforeGroupBreak event:
ppGHBwono.NewPageThreshold:= CalculateWONONewPageThr;
if ( ( ppReport1.Engine.PrintPosRect.Top +
ppGHBwono.mmHeight +
ppGRPwono.mmNewPageThreshold ) > ppReport1.Engine.PageBottom ) then
ppGHBwono.OutOfSpace:=True;
Unfortunately, in the common case where I hide the detail band the
"CalculateWONONewPageThr" routine has to assume that a footer will be coming
along next and add this footer height to the threshold. This means I
sometimes get bigger whitespace at the end of the page than I should.
So, I'm still trying to figure out how to test for "footer band next".
EdB
footer band on the given page or not before the report is displayed? Note
that for later versions of ReportBuilder (RB 9 and later) we included a
PageBreak component that allows you to break to a new page whenever you
like. This component could be very helpful in your case.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'd determine if the footer was there? Would two-pass be enough though - as
soon as I force a page break, that shifts everything down and one of the
"next" pages might have a new footer... Or does "two pass" perform two
passes per page (I always thought two passes traversing entire report).
The "OutOfSpace" approach is working great - just gotta find those footers!
I'll eventually upgrade, I just have some very particular code in a few
projects that flags entire report sent to printer (and that user didn't
cancel, skip pages, or send to non-printer device). I'd need to do a LOT of
testing of all my code before I'd feel safe in distributing with upgraded
RB. I'm pretty paranoid. I'm also waiting for new fiscal year to get new
hardware and reinstall everything *once*.
Thanks.
EdB
Now that I think about it more, I do not believe two pass will work in your
case due to the fact that you need to change the actual page spacing on the
fly. Once the first pass is finished, all spacing for the page is
calculated. It would be possible to hide or show certain components however
it would not be possible to remove white space.
From the other thread, you mention that you would like to know if the footer
is the last item printed. If the footer band is visible, it will always be
the last item printed on the last page. Perhaps I'm a bit unclear about
what you would like to find out and why.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
failure to take into account the footer height...
And, at this point anyway, my customer isn't yelling anymore... .
I think I might be ok with what I've come up with - so this is just for
"curiosity sake" now:
(you can probably skip down to "***** start here *****" to get a sense of
*what* I'm doing, the rest of this is *why* I'm doing this)
I'm reporting on manufacturing work orders. The structure is basically:
work order no (group[0])
operation (group[1])
material (detail)
All bands are static height, I recalculate the height of operation band at
run-time.
The work order band simply shows column titles and field info
[wono] [fld] [fld] [fld]
The Operation Band shows:
[Region with duplicated Work order Band fields]
[Region with Operation Band titles]
[Region with Operation band fields]
[Region with Detail band column titles]
The detail band simply shows material field information:
[material] [qty] [fld]
The WONO (group[0]) footer simply shows a (Top) line and a bit of whitespace
------------------
At run time I create a ClientDataSet that "de-normalizes" the data such that
instead of master-detail, I access a a "flattened" file. I precalculated
things like HasMaterial: boolean (does the current wono-operation have
material?)
HasMaterial, wono, opno, material, fld, fld, NeedSetupBreak ...
It turns out that some operations have no material associated with them (for
example, operations for machine SETUP), so I need to hide the detail band
for these. When a work order flows unto a new page, the customer wants to
see the work order band, but not the operation band (unless of course it is
a new operation). The customer ALSO wants to see the work order header
information repeated in the event a work order has TWO setup operations...
(***** start here *****)
I'm constantly having to hide or show the various regions in the Group[1]
(operation) band based on the current record. That is if it "HasMaterial"
then I make the detail band visible, turn on the region with Material
titles, and deal with the other regions in the Operation Band based on flags
and data as well.
I've got that logic nailed. I set the height of the operation band so
everything that is visible "fits", then set the NewPageThreshold to the
height of the detail band (if HasMaterial is true).
Where my logic fails is if there is NO material and I'm at the end of the
page. Consider the following:
HasMat WoNo OpNo Material
Y 1000 10 abc
Y 1000 20 def
N 1000 30
Y 2000 10 abc
When I'm at WONO 1000, Operation 30 - there is no material (therefore no
detail band). I don't know until the next record shows up that I've hit the
end of WONO 1000 and need to print a footer. So, when calculating
NewPageThreshold I either have to factor in the height of the footer for
EVERY record without material, or ignore the footer height all the time (and
occassionally print an oprhaned work order header at the bottom of the page
with the operation band on the next page).
I can beat this by adding a "IsLastRecordForWoNo_OpNo" column to the data
and parsing/calculating it before I run the report, but I was hoping for a
generic way in RB to tell me "this is last rec this group" instead.
EdB