Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Better way to do orphan/widow in a report
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01158138
Message ID:
01159671
Views:
28
Hi Bo,

Sorry for the confusion....my fault. The goal is to prevent "orphan/widow" (or one of the two - I can never remember which one) where there is 1 line on the top of a page - in this case, the last page. Therefore, if there is not enough room to print all the detail lines on the last page such that the very last line prints by itself on the last page, then they want 2 detail lines to print on the last page.

I also misunderstood what you were trying to do with your code - so I implemented it using the 2nd last detail line, thus the " + 1" which worked (maybe with unforseen future problems). I will change the code to work on the 3rd last detail record as I know "get" what you were trying to do.

I still need to read some of the other suggested articles but off the top of your head, it there any way to know the size that the summary band will be before the report writer processes the summary band? Note that the summary band can grow as it has a memo field that has a variable number of lines in it). A new requirement is that the summary band also not print by itself on the last page. My guess is that I cannot get it's height until that band is rendered and thus, I am going to guess that I have to do a "two pass" through the report to get the size. The new requirement is that the summary band does not print by itself on the last page (if the 2nd to last page ended up printing all the detail lines) and if it were so, that I push ahead two detail lines to print with the summary (a "looks" thing again). Thinking out loud here, I have to figure out if the original problem we just worked through can happen on it's own or is the real problem "the last page of the printout must always have two detail lines plus the summary print on it".

Albert


>Hi ALbert,
>
>>1) the other objects in the band have to have their property set to "Fix relative to bottom" (I think - at least that is what worked for me).
>
>This could cause a problem. Using the tecnique presented in the code I sent will cause all of those controls to appear at the bottom of the page. It may require a different approach.
>
>>2) I had to set the height of the box to Max height + 1 - to force the band to the next page
>
>This will force the 3rd from the bottom record to the next page. I would think this would be the desired effect. The idea of setting .Height = .MaxHeightAvailable is to force the 3rd from the bottom record to use all available space on this page, so the 2nd from the bottom record will start on the next page.
>
>>3) your code below no longer compares the height of the box to the max height available - just a skip or for some reason did your logic change on this?
>
>This change was based on you last response. This will force the last 2 records to ALWAYS start on a new page. The previous code would force the last 2 records to appear on the next page ONLY if there wasn't room on the current page to display BOTH records.
>
>I'm still not clear on everything you are trying to accomplish, but I hope this gives you some ideas and a good starting point. The new ReportListener can be very powerful once you understand all the things you can accomplish with it.
Previous
Reply
Map
View

Click here to load this message in the networking platform