Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.LeftMargin = 10 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 20 '设置上边距
Doc.PageSetting.BottomMargin = 10 '
Dim rm As prt.RenderEmpty
Dim tb As Table = Tables("学位申请_table2")
For i As Integer = tb.TopPosition To tb.BottomPosition
Dim fr As DataRow = DataTables("学位类别").find("说明= '" & tb.Rows(i)("类型说明") & "'")
Dim yd As String
If fr IsNot Nothing
yd = fr("应带资料")
End If
rm = new prt.RenderEmpty '定义一个新的空对象
rm.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rm)
If tb.Rows(i)("类别").Contains("B")
Dim rt As New prt.RenderText '定义一个文本对象
rt.Text = "2018年东兴区进城务工(经商)人员随迁子女初一学位申请卡(蓝卡主卡)" '设置文本对象的内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("黑体", 16, FontStyle.Bold) '设置字体
doc.Body.Children.Add(rt) '将文本对象加入到报表ga
Dim rt1 As New prt.RenderText
rt1.Text =" 编号:" & tb.Rows(i)("bh") & " " & tb.Rows(i)("类型说明")
rt1.Style.Font = New Font("黑体", 12)
rt1.Style.Spacing.Top = 4
rt1.Style.Spacing.bottom = 2
doc.Body.Children.Add(rt1)
Dim rt6 As New prt.RenderTable() '定义一个表格对象
rt6.Style.GridLines.All = New prt.Linedef '设置网格线
rt6.Rows.Count = 8 '设置行数
rt6.Cols.Count = 6
rt6.Style.Font = New Font("楷体", 10)
rt6.Height = 90
rt6.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt6.Style.TextAlignVert = prt.AlignVertEnum.Center
rt6.Cols(0).Width = 45
rt6.Cols(1).Width = 30
rt6.Cols(2).Width = 20
rt6.Cols(3).Width = 20
rt6.Cols(4).width = 20
rt6.Cols(5).width = 75
rt6.rows(8).Height = 30
rt6.Cells(0, 0).Text = "学生姓名"
rt6.Cells(0, 1).Text = tb.Rows(i)("xsxm")
rt6.Cells(0, 2).Text = "性别"
rt6.Cells(0, 3).Text = tb.Rows(i)("xb")
rt6.Cells(0, 4).Text = "毕业学校"
rt6.Cells(0, 5).Text = tb.Rows(i)("byxx")
rt6.Cells(1, 0).Text = "身份证号"
rt6.Cells(1,1).SpanCols = 3
rt6.Cells(1,1).text =tb.Rows(i)("sfzh")
rt6.Cells(1, 4).Text = "学籍号码"
rt6.Cells(1, 5).Text = tb.Rows(i)("xjh")
rt6.Cells(2, 0).Text = "划片学校"
rt6.Cells(2,1).SpanCols = 3
rt6.Cells(2,1).text =tb.Rows(i)("hpxx")
rt6.Cells(2,4).text = "申请学校"
rt6.Cells(2,5).text =tb.Rows(i)("sqxx")
rt6.Cells(3, 0).Text = "户籍地址"
rt6.Cells(3,1).SpanCols = 3
rt6.Cells(3,1).text = tb.Rows(i)("fjdz")
rt6.Cells(3,4).text ="居住地址"
rt6.Cells(3,5).text =tb.Rows(i)("jzdz")
rt6.Cells(4, 0).Text = "父(母)或监护人姓名"
rt6.Cells(4,1).SpanCols = 3
rt6.Cells(4,1).text = tb.Rows(i)("jfr")
rt6.Cells(4,4).text = "联系电话"
rt6.Cells(4,5).text = tb.Rows(i)("lxdh")
rt6.Cells(5, 0).Text = "父(母)或监护人务工单位"
rt6.Cells(5,1).SpanCols = 3
rt6.Cells(5,1).text = tb.Rows(i)("jfrwgdw")
rt6.Cells(5, 4).Text = "单位地址"
rt6.Cells(5, 5).Text = tb.Rows(i)("jfrwgdwdz")
rt6.Cells(7, 0).Text = "父(母)或监护人签字"
rt6.Cells(7, 2).Text = "初审签字"
rt6.Cells(7, 4).Text = "复核签字"
rt6.Cells(6, 0).Text = "单位负责人"
rt6.Cells(6,1).SpanCols = 3
rt6.Cells(6,1).text = tb.Rows(i)("wgdwfzr")
rt6.Cells(6, 4).Text = "负责人电话"
rt6.Cells(6, 5).Text = tb.Rows(i)("wgdwrdh")
rt6.Cells(8, 0).Text = "区教育行政主管部门审核意见"
rt6.Cells(8,1).SpanCols = 5
doc.Body.Children.Add(rt6)
rt1 = New prt.RenderText
rt1.Text ="注意事项: 1.请家长和学生仔细阅读学位卡正反面的内容,关注招生学校的招生计划,理性填报申请就读学校,确定信息确无误后签字."
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text =" 2.请您于5月21日至25日到西林中学办理资料复核,逾期未办理复核视为该卡自动放弃并作废.复核通过后于5月28日至30日填好申请学校后交回原办理点"
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text =" 3.办理时请带好:" & yd
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
'rt1.Style.Spacing.Top =
rt1.Text ="盖骑缝章"
rt1.x=95
rt1.y=145
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="(签字盖章)"
rt1.x=145
rt1.y=106
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="年 月 日"
rt1.x=145
rt1.y=116
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
Dim Line As New prt.LineDef(0.5, Color.black, DashStyle.Dot)
Dim ln As New prt.RenderLine(10,148, 200, 148, Line)
doc.body.Children.Add(ln) '将线
rt = New prt.RenderText '定义一个文本对象
rt.Style.Spacing.Top = 30
rt.Text = "2018年东兴区进城务工(经商)人员随迁子女初一学位申请卡(蓝卡副卡)" '设置文本对象的内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("黑体", 16, FontStyle.Bold) '设置字体
'rt.Height =15
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt1 = New prt.RenderText
rt1.Text =" 编号:" & tb.Rows(i)("bh") & " " & tb.Rows(i)("类型说明")
rt1.Style.Font = New Font("黑体", 12)
rt1.Style.Spacing.Top = 4
rt1.Style.Spacing.bottom = 2
doc.Body.Children.Add(rt1)
rt6 =New prt.RenderTable() '定义一个表格对象
rt6.Style.GridLines.All = New prt.Linedef '设置网格线
rt6.Style.Spacing.Bottom = 4
rt6.Rows.Count = 8 '设置行数
rt6.Cols.Count = 6
rt6.Style.Font = New Font("楷体", 10)
'rt6.Rows(0).Style.font = New Font("宋体", 15) '设
rt6.Height = 90
rt6.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt6.Style.TextAlignVert = prt.AlignVertEnum.Center
rt6.Cols(0).Width = 45
rt6.Cols(1).Width = 30
rt6.Cols(2).Width = 20
rt6.Cols(3).Width = 20
rt6.Cols(4).width = 20
rt6.Cols(5).width = 75
rt6.rows(8).Height = 15
rt6.Cells(0, 0).Text = "学生姓名"
rt6.Cells(0, 1).Text = tb.Rows(i)("xsxm")
rt6.Cells(0, 2).Text = "性别"
rt6.Cells(0, 3).Text = tb.Rows(i)("xb")
rt6.Cells(0, 4).Text = "毕业学校"
rt6.Cells(0, 5).Text = tb.Rows(i)("byxx")
rt6.Cells(1, 0).Text = "身份证号"
rt6.Cells(1,1).SpanCols = 3
rt6.Cells(1,1).text =tb.Rows(i)("sfzh")
rt6.Cells(1, 4).Text = "学籍号码"
rt6.Cells(1, 5).Text = tb.Rows(i)("xjh")
rt6.Cells(2, 0).Text = "划片学校"
rt6.Cells(2,1).SpanCols = 3
rt6.Cells(2,1).text =tb.Rows(i)("hpxx")
rt6.Cells(2,4).text = "申请学校"
rt6.Cells(2,5).text =tb.Rows(i)("sqxx")
rt6.Cells(3, 0).Text = "户籍地址"
rt6.Cells(3,1).SpanCols = 3
rt6.Cells(3,1).text = tb.Rows(i)("fjdz")
rt6.Cells(3,4).text ="居住地址"
rt6.Cells(3,5).text =tb.Rows(i)("jzdz")
rt6.Cells(4, 0).Text = "父(母)或监护人姓名"
rt6.Cells(4,1).SpanCols = 3
rt6.Cells(4,1).text = tb.Rows(i)("jfr")
rt6.Cells(4,4).text = "联系电话"
rt6.Cells(4,5).text = tb.Rows(i)("lxdh")
rt6.Cells(5, 0).Text = "父(母)或监护人务工单位"
rt6.Cells(5,1).SpanCols = 3
rt6.Cells(5,1).text = tb.Rows(i)("jfrwgdw")
rt6.Cells(5, 4).Text = "单位地址"
rt6.Cells(5, 5).Text = tb.Rows(i)("jfrwgdwdz")
rt6.Cells(6, 0).Text = "单位负责人"
rt6.Cells(6,1).SpanCols = 3
rt6.Cells(6,1).text = tb.Rows(i)("wgdwfzr")
rt6.Cells(6, 4).Text = "负责人电话"
rt6.Cells(6, 5).Text = tb.Rows(i)("wgdwrdh")
rt6.Cells(7, 0).Text = "父(母)或监护人签字"
rt6.Cells(7, 2).Text = "初审签字"
rt6.Cells(7, 4).Text = "复核签字"
rt6.Cells(8, 0).Text = "教育部门监督人员签字"
rt6.Cells(8,1).SpanCols = 5
doc.Body.Children.Add(rt6)
rt1 = New prt.RenderText
rt1.Text ="注:副卡最后一栏内教育部门监督人员在招生对象未被摇号方式录取后到有空余学位学校登记时填写."
rt1.Style.Font = New Font("黑体", 10)
doc.Body.Children.Add(rt1)
doc.Preview() '预览
End If
If tb.Rows(i)("类别").Contains("A")
Dim rt As New prt.RenderText '定义一个文本对象
rt.Text = "2018年内江市东兴区小学毕业生初一学位申请(白卡主卡)" '设置文本对象的内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("黑体", 16, FontStyle.Bold) '设置字体
doc.Body.Children.Add(rt) '将文本对象加入到报表
Dim rt1 As New prt.RenderText
rt1.Text =" 编号:" & tb.Rows(i)("bh") & " " & tb.Rows(i)("类型说明")
rt1.Style.Font = New Font("黑体", 12)
rt1.Style.Spacing.Top = 4
rt1.Style.Spacing.bottom = 2
doc.Body.Children.Add(rt1)
Dim rt6 As New prt.RenderTable() '定义一个表格对象
rt6.Style.GridLines.All = New prt.Linedef '设置网格线
'rt6.Style.Spacing.Bottom = 4
rt6.Rows.Count = 8 '设置行数
rt6.Cols.Count = 6
rt6.Style.Font = New Font("楷体", 10)
'rt6.Rows(0).Style.font = New Font("宋体", 15) '设
rt6.Height = 90
rt6.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt6.Style.TextAlignVert = prt.AlignVertEnum.Center
rt6.Cols(0).Width = 45
rt6.Cols(1).Width = 30
rt6.Cols(2).Width = 20
rt6.Cols(3).Width = 20
rt6.Cols(4).width = 20
rt6.Cols(5).width = 75
rt6.rows(7).Height = 30
rt6.Cells(0, 0).Text = "学生姓名"
rt6.Cells(0, 1).Text = tb.Rows(i)("xsxm")
rt6.Cells(0, 2).Text = "性别"
rt6.Cells(0, 3).Text = tb.Rows(i)("xb")
rt6.Cells(0, 4).Text = "毕业学校"
rt6.Cells(0, 5).Text = tb.Rows(i)("byxx")
rt6.Cells(1, 0).Text = "身份证号"
rt6.Cells(1,1).SpanCols = 3
rt6.Cells(1,1).text =tb.Rows(i)("sfzh")
rt6.Cells(1, 4).Text = "学籍号码"
rt6.Cells(1, 5).Text = tb.Rows(i)("xjh")
rt6.Cells(2, 0).Text = "划片学校"
rt6.Cells(2,1).SpanCols = 3
rt6.Cells(2,1).text =tb.Rows(i)("hpxx")
rt6.Cells(2,4).text = "申请学校"
rt6.Cells(2,5).text =tb.Rows(i)("sqxx")
rt6.Cells(3, 0).Text = "户籍地址"
rt6.Cells(3,1).SpanCols = 3
rt6.Cells(3,1).text = tb.Rows(i)("fjdz")
rt6.Cells(3,4).text ="居住地址"
rt6.Cells(3,5).text =tb.Rows(i)("jzdz")
rt6.Cells(4, 0).Text = "父(母)或监护人姓名"
rt6.Cells(4,1).SpanCols = 3
rt6.Cells(4,1).text = tb.Rows(i)("jfr")
rt6.Cells(4,4).text = "联系电话"
rt6.Cells(4,5).text = tb.Rows(i)("lxdh")
rt6.Cells(5, 0).Text = "父(母)或监护人务工单位"
rt6.Cells(5,1).SpanCols = 3
rt6.Cells(5,1).text = tb.Rows(i)("jfrwgdw")
rt6.Cells(5, 4).Text = "单位地址"
rt6.Cells(5, 5).Text = tb.Rows(i)("jfrwgdwdz")
rt6.Cells(6, 0).Text = "父(母)或监护人签字"
rt6.Cells(6, 2).Text = "初审签字"
rt6.Cells(6, 4).Text = "复核签字"
rt6.Cells(7, 4).Text = "区教育行政主管部门审核意见"
rt6.Cells(7, 0).Text = "毕业学校审核意见"
rt6.Cells(7,1).SpanCols = 3
doc.Body.Children.Add(rt6)
rt1 = New prt.RenderText
rt1.Text ="注意事项: 1.请家长和学生仔细阅读学位卡正反面的内容,关注招生学校的招生计划,理性填报申请就读学校,确定信息确无误后签字."
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
If tb.Rows(i)("类型说明").Contains("A1")
rt1.Text =" 2.学生于5月28日至31日在学校申请此卡时直接填报申读学校,确认后签字,学校统一交教育局复核,复核通过后副卡返学生保管理"
End If
If tb.Rows(i)("类型说明").Contains("A2")
rt1.Text =" 2.请您于5月21日至25日到西林中学办理资料复核,逾期未办理复核视为该卡自动放弃并作废.复核通过后于5月29至30日填报申请学校后交回原申请点"
End If
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text =" 3.办理时请带好:" & yd
rt1.Style.Font = New Font("黑体", 8)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="盖骑缝章"
rt1.x=95
rt1.y=145
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="(签字盖章)"
rt1.x=85
rt1.y=106
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="年 月 日"
rt1.x=85
rt1.y=116
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="(签字盖章)"
rt1.x=175
rt1.y=106
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
rt1 = New prt.RenderText
rt1.Text ="年 月 日"
rt1.x=175
rt1.y=116
rt1.Style.Font = New Font("宋体", 10)
doc.Body.Children.Add(rt1)
Dim Line As New prt.LineDef(0.5, Color.black, DashStyle.Dot)
Dim ln As New prt.RenderLine(10,148, 200, 148, Line)
doc.body.Children.Add(ln) '将线
rt = New prt.RenderText '定义一个文本对象
rt.Style.Spacing.Top = 30
rt.Text = "2018年内江市东兴区小学毕业生初一学位申请(白卡副卡)" '设置文本对象的内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("黑体", 16, FontStyle.Bold) '设置字体
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt1 = New prt.RenderText
rt1.Text =" 编号:" & tb.Rows(i)("bh") & " " & tb.Rows(i)("类型说明")
rt1.Style.Font = New Font("黑体", 12)
rt1.Style.Spacing.Top = 4
rt1.Style.Spacing.bottom = 2
doc.Body.Children.Add(rt1)
rt6 =New prt.RenderTable() '定义一个表格对象
rt6.Style.GridLines.All = New prt.Linedef '设置网格线
rt6.Style.Spacing.Bottom = 4
rt6.Rows.Count = 8 '设置行数
rt6.Cols.Count = 6
rt6.Style.Font = New Font("楷体", 10)
rt6.Height = 90
rt6.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt6.Style.TextAlignVert = prt.AlignVertEnum.Center
rt6.Cols(0).Width = 45
rt6.Cols(1).Width = 30
rt6.Cols(2).Width = 20
rt6.Cols(3).Width = 20
rt6.Cols(4).width = 20
rt6.Cols(5).width = 75
rt6.rows(7).Height = 15
rt6.Cells(0, 0).Text = "学生姓名"
rt6.Cells(0, 1).Text = tb.Rows(i)("xsxm")
rt6.Cells(0, 2).Text = "性别"
rt6.Cells(0, 3).Text = tb.Rows(i)("xb")
rt6.Cells(0, 4).Text = "毕业学校"
rt6.Cells(0, 5).Text = tb.Rows(i)("byxx")
rt6.Cells(1, 0).Text = "身份证号"
rt6.Cells(1,1).SpanCols = 3
rt6.Cells(1,1).text =tb.Rows(i)("sfzh")
rt6.Cells(1, 4).Text = "学籍号码"
rt6.Cells(1, 5).Text = tb.Rows(i)("xjh")
rt6.Cells(2, 0).Text = "划片学校"
rt6.Cells(2,1).SpanCols = 3
rt6.Cells(2,1).text =tb.Rows(i)("hpxx")
rt6.Cells(2,4).text = "申请学校"
rt6.Cells(2,5).text =tb.Rows(i)("sqxx")
rt6.Cells(3, 0).Text = "户籍地址"
rt6.Cells(3,1).SpanCols = 3
rt6.Cells(3,1).text = tb.Rows(i)("fjdz")
rt6.Cells(3,4).text ="居住地址"
rt6.Cells(3,5).text =tb.Rows(i)("jzdz")
rt6.Cells(4, 0).Text = "父(母)或监护人姓名"
rt6.Cells(4,1).SpanCols = 3
rt6.Cells(4,1).text = tb.Rows(i)("jfr")
rt6.Cells(4,4).text = "联系电话"
rt6.Cells(4,5).text = tb.Rows(i)("lxdh")
rt6.Cells(5, 0).Text = "父(母)或监护人务工单位"
rt6.Cells(5,1).SpanCols = 3
rt6.Cells(5,1).text = tb.Rows(i)("jfrwgdw")
rt6.Cells(5, 4).Text = "单位地址"
rt6.Cells(5, 5).Text = tb.Rows(i)("jfrwgdwdz")
rt6.Cells(6, 0).Text = "父(母)或监护人签字"
rt6.Cells(6, 2).Text = "初审签字"
rt6.Cells(6, 4).Text = "复核签字"
rt6.Cells(7, 0).Text = "教育部门监督人员签字"
rt6.Cells(7,1).SpanCols = 5
doc.Body.Children.Add(rt6)
rt1 = New prt.RenderText
rt1.Text ="注:副卡最后一栏内教育部门监督人员在招生对象未被摇号方式录取后到有空余学位学校登记时填写."
rt1.Style.Font = New Font("黑体", 10)
doc.Body.Children.Add(rt1)
End If
Next
doc.Preview() '预览
上面是想框选记录分别打印,但实际效果没实现,而是选3条记录预览只有两条,什么问题,并且是预览后又变成2条预览,请老师指示