Black belt in coresuite designer series part 3 : fill up the empty space on the last page with filler rows

Hi dear follower

The following blog takes care about how you can add additional rows into a layout to fill up the space you have at the end of a report.

So in this case designer automatically added two more filler rows at the end.

Feel free to also watch this movie where you see it in action:

Well how to approach this kind of layout templates:

1. We need to know where the last row ends on the rendered page

This we solve by just using a marker detail:

And in its generate script we will memorize the render position if we are in first pass:

If Not Engine.IsDoublePass Then ' in the first run just memorize the last position lastItemRenderHeight = Engine.UsedHeight ... 

2. We need to set the count of repeats of the filler databand
This is solved as well in the generatescript of the marker detail, but this time the part in the second render pass is interesting:

If Not Engine.IsDoublePass Then

Else
 ' in the second run set the nr. of repeats of the filler databand
 If RowFiller.InstanceCount = 0 Then
 ' calculate the lower boundary by subtracting the footer(s) from the pagesize
 Dim footerStartRenderHeight As Integer = Engine.PageRenderArea.Size.Height - pftMaster.RenderHeight
 'MessageBox.Show(footerStartRenderHeight & " " & lastItemRenderHeight & " " & txtFiller.Size.Height)
 Dim nrOfRepeats As Integer = (footerStartRenderHeight - lastItemRenderHeight) / txtFiller.Size.Height 
 RowFiller.InstanceCount = nrOfRepeats
 End If
End If 

So the amount of  rows gets dynamically calculated by dividing the space in  between the footer and the last row by the height of the filler row. This result we use to set the databands instancecount property which makes the magic happen then.
(I didn’t place the calculation into the generatescript of the databand because instancecount needs to be set prior any action starts with the databand)

Get the layoutdefinition here.

Hope this helps you if you once will encounter this specific requirement. Sometimes it’s really interesting what customer wants to display. But hey, as you can see with the coresuite country package you have the weapon of choice to target as well those requirements.

Have fun!

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.