Dim iHeight As Double
Dim columnData_form As DataSourceBase
iHeight=Page1.TopMargin
columnData_form=Report.GetDataSource("rpt_PurInDepart_Detail")
columnData_form.Init
For i As Integer =1 To iSelectRows
iHeight=iHeight+Data1.Height/37.8*10
iHeight=iHeight+DataFooter1.Height/37.8*10
Next
iHeight=iHeight+Data2.Height/37.8*10*columnData_form.RowCount
iHeight=iHeight+Page1.BottomMargin
Page1.PaperHeight=iHeight