Tuesday, February 12, 2013

how to use page breaks to keep a table in one page

This is how to keep a table in one page by counting row number with custom code.

Here I have three row groups - region, district, and store


For a region group, I can simply add 'Between each instance of group' page break.

However, district group has a problem when it has to break down into two pages because of number of stores in that group.

============================================================
Best thing I could do about it was to add a custom code.

dim total as integer = 0
dim regionID as integer = 0

function getRowCount(i as Integer, r as Integer ) as boolean
if regionID <> r then
regionID = r
total = 0
end if
total = total + i
if total <= 45 then
return true
else 
total = i
return false
end if
end function
===========================================================

and use group property variables with expression


and then use properties to set page break.


and that's it. This will prevent a table splitting in two pages.

No comments:

Post a Comment