Tables("补偿标准").Filter ="" '取消筛选
Tables("征地数据").Filter ="" '取消筛选
Dim Q As String
Q = e.Form.Controls("项目名称").Value
If Q = "" Then
MessageBox.Show("你未选择需要生成个人征地数据的项目!!!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
Return '终止代码的执行
Else
Dim ck As WinForm.ComBoBox = e.Form.Controls("项目名称")
Tables("补偿标准").Filter = "[项目名称] = '" & ck.value & "'" '筛选出指定项目名称的行
Tables("征地数据").Filter = "[项目名称] = '" & ck.value & "'" '筛选出指定项目名称的行
With CurrentTable
.Select(0,0,.rows.count-1,0)
End With
Dim doc As New PrintDoc '定义一个报表
Dim tbl As Table = Tables("征地数据")
For i As Integer = tbl.TopRow To tbl.BottomRow
Dim rw As Row = tbl.Rows(i)
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim ra As New prt.RenderArea '定义一个容器
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止容器因为分页而被垂直分割
'加入标题
rx.text = "征地数据公示表"
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 16 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rx.Style.Spacing.Bottom = 3 '和下面的对象(表格)距离3毫米
ra.Children.Add(rx) '加入到容器中
'指定行数?列数?列宽?行高
rt.Rows.Count = 5 '设置总行数
rt.Cols.Count = 4 '设置总列数
rt.Height = 75 '设置表格的高度
rt.Cols(0).Width = 30
rt.Cols(1).Width = 30
rt.Cols(2).Width = 30
rt.Style.Spacing.Bottom = 20 '和下一个资料卡的距离是20毫米
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cols(3).Width = 30
rt.Cells(0,0).Text= "序号:"
rt.Cells(0,1).Text = rw("序号")
rt.Cells(0,2).Text= "姓名:"
rt.Cells(0,3).Text = rw("姓名")
rt.Cells(1,0).Text= "补偿种类"
rt.Cells(1,1).Text = "补偿数量"
rt.Cells(1,2).Text = "补偿标准"
rt.Cells(1,3).Text = "补偿金额"
rt.Cells(2,0).Text= "稻田"
rt.Cells(3,0).Text= "旱地"
rt.Cells(4,0).Text= "堡坎"
rt.Cells(2,1).Text= rw("征用稻田面积")
rt.Cells(3,1).Text= rw("征用旱地面积")
rt.Cells(4,1).Text= rw("堡坎方量")
Dim tb2 As Table = Tables("补偿标准")
For H As Integer = tb2.TopRow To tb2.BottomRow
Dim rw1 As Row = tb2.Rows(H)
rt.Cells(2,2).Text= rw1( "稻田补偿标准")
rt.Cells(3,2).Text= rw1( "旱地补偿标准")
rt.Cells(4,2).Text= rw1( "堡坎补偿标准")
Next
ra.Children.Add(rt) '加入到容器中
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
Next
Doc.Preview() '预览报表
End If