-- 作者:gdtgl
-- 发布时间:2008/11/30 3:43:00
--
Dim dst As WinForm.DataList = Forms("窗口").Controls("DataList1") For Index As Integer = 0 To dst.Count - 1 If dst.GetChecked(Index) Then Dim dr As DataRow = dst.GetDataRow(Index) dr("记录") = true \'将 记录 列设为true if dr("记录") = true then \'作标记,打印之后,下次不再打印
\'********报表************ Dim doc As New Printdoc \'Doc.PageSetting.LeftMargin = 20 \'设置左边距 \'Doc.PageSetting.RightMargin = 17 \'设置右边距 Doc.Columns.Add() \'增加第一栏 Doc.Columns.Add() \'增加第二栏 Doc.Columns(0).Spacing = 0 \'栏间距0毫米 Dim rt2 As New prt.RenderTable() \'定义一个表格对象 rt2.Style.GridLines.All = prt.Linedef.Default \'网格线为默认类型 rt2.Cols.Count = 2 \'设置总列数 rt2.Cells(0,0).SpanCols = 2 \'第1行第1列向右合并2列 rt2.Cells(1,0).SpanCols = 2 \'第2行第1列向右合并2列 rt2.Cells(2,0).SpanCols = 2 \'第3行第1列向右合并2列 rt2.Cells(3,0).SpanCols = 2 \'第4行第1列向右合并2列 rt2.Cells(9,0).SpanCols = 2 \'第10行第1列向右合并2列 rt2.Cells(10,0).SpanCols = 2 \'第11行第1列向右合并2列 rt2.Cells(11,0).SpanCols = 2 \'第12行第1列向右合并2列 rt2.Cells(12,0).SpanCols = 2 \'第13行第1列向右合并2列 rt2.Cells(13,0).SpanCols = 2 \'第14行第1列向右合并2列 rt2.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'设置第一行居中 rt2.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'设置第二行居中 rt2.Cells(0,0).Style.FontSize = 30 \'设置第一行字体 rt2.Cells(1,0).Style.FontSize = 15 \'设置第二行字体 rt2.CellStyle.Spacing.All = 1 \'行与行之间的间隔 rt2.Cells(0,0).text = "单位" rt2.Cells(1,0).text = "记录" rt2.Cells(2,0).text = "管理编号: " rt2.Cells(3,0).Text = "编号: " & Tables("表A").rows(Index)("编号") rt2.Cells(4,0).Text = "名称: " & Tables("表A").rows(Index)("名称") rt2.Cells(4,1).Text = "数量: " & Tables("表A").rows(Index)("数量") rt2.Cells(5,0).Text = "项目: " & "----" rt2.Cells(5,1).Text = "依据: " & "------" rt2.Cells(6,0).Text = "-: " & "------" rt2.Cells(6,1).Text = "方法: " & "------" doc.pageheader = rt2 \'加入到页眉中
\'关联表报表内容 Dim rt As prt.RenderTable rt = New prt.RenderTable rt.Style.GridLines.All = prt.Linedef.Default \'网格线为默认类型 rt.CellStyle.Spacing.All = 1 \'行与行之间的间隔 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.all \'将第一行作为表头. Dim bctbl As dataTable = dataTables("表C") dim bcrows as list(of datarow) bcrows = bctbl.select("[编号] = \'" & dr("编号") & "\'") \'dim bchs as integer = bcrows.count if bcrows.count < 58 then for bci as integer = 0 to bcrows.count -1 rt.Cells(0,0).Text = "地点" rt.Cells(0,1).Text = "编号" rt.Cells(0,2).Text = "名称" rt.Cells(0,3).Text = "-" rt.Cells(bci+1,0).Text = bcrows(bci)("地点") rt.Cells(bci+1,1).Text = bcrows(bci)("编号") rt.Cells(bci+1,2).Text = bcrows(bci)("名称") rt.Cells(bci+1,3).Text = bcrows(bci)("-") for jia as integer = bci+1 to 58 rt.Cells(jia,3).Text = " " next next else for bci as integer = 0 to bcrows.count -1 rt.Cells(0,0).Text = "地点" rt.Cells(0,1).Text = "编号" rt.Cells(0,2).Text = "名称" rt.Cells(0,3).Text = "-" rt.Cells(bci+1,0).Text = bcrows(bci)("地点") rt.Cells(bci+1,1).Text = bcrows(bci)("编号") rt.Cells(bci+1,2).Text = bcrows(bci)("名称") rt.Cells(bci+1,3).Text = bcrows(bci)("-") for jia2 as integer = bci+1 to 116 rt.Cells(jia2,3).Text = " " next next
end if
doc.Body.Children.Add(rt)
\'****设置页脚**** Dim rxx As New prt.RenderTable() \'rxx.Style.GridLines.All = prt.Linedef.Default \'是否需要网格 rxx.Cols.Count = 2 \'设置总列数 rxx.rows(1).Style.Borders.Bottom = New prt.LineDef rxx.Cells(0,0).text ="-:" rxx.Cells(0,1).text ="-:" rxx.Cells(0,2).text ="-:" rxx.Cells(0,3).text = "日期:" rxx.Cells(0,4).text = "-:" doc.PageFooter = rxx doc.Preview
end if end if next
|