Dim doc As New PrintDoc() '定义一个报表
Dim ra As New prt.RenderArea '定义一个容器
Dim rtt2 As New prt.RenderTable() '定义一个表格对象
rtt2.name = "tb2"
'rtt.y = 26
rtt2.Width = "100%Parent.Width"
rtt2.Cols(0).Width= "8%Parent.Width"
rtt2.Cols(1).Width= "25%Parent.Width"
rtt2.Cols(2).Width= "25%Parent.Width"
rtt2.Cols(3).Width= "10%Parent.Width"
rtt2.Cols(4).Width= "10%Parent.Width"
'rtt.Cols(5).Width= "%Parent.Width"
rtt2.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rtt2.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居
rtt2.Cells(0,0).Text="序号"
rtt2.Cells(0,1).Text= "产品名称"
rtt2.Cells(0,2).Text="规格型号"
rtt2.Cells(0,3).Text= "数量"
rtt2.Cells(0,4).Text="单位"
rtt2.Cells(0,5).Text="备注"
rtt2.Style.Padding.Top=2
rtt2.Style.Font=New Font("宋体", 12)
rtt2.Style.GridLines.All = New prt.Linedef '设置网格线
rtt2.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
'rtt.Style.Spacing.Top=14
rtt2.RowGroups(0,2).Header = prt.TableHeaderEnum.All '将第一行作为表头.
'Dim drsa As List(of DataRow) = DataTables("EntOut").Select("Main_ID = '" & s("_Identify") & "'")
'Dim ki As Integer = 0
Dim coui As Integer = 3
For i As Integer = 0 To 3 - 1 'drsa.Count - 1
' ki += 1
rtt2.Cells(i + 1,0).Text = i + 1
rtt2.Cells(i + 1,1).Text= "111" ' drsa(i)("Mat_Name")
rtt2.Cells(i + 1,1).Style.TextAlignHorz=prt.AlignHorzEnum.left
rtt2.Cells(i + 1,2).Text = "222" ' Functions.Execute("ExcelGgtSpec_1",DataTables("EntOut"),drsa(i))
rtt2.Cells(i + 1,2).Style.TextAlignHorz=prt.AlignHorzEnum.left
rtt2.Cells(i + 1,3).Text = "333" ' drsa(i)("EntQuant")
rtt2.Cells(i + 1,4).Text = "444" ' drsa(i)("_unit")
rtt2.Cells(i + 1,5).Text = "555" ' drsa(i)("_Remarks")
Next
If coui < 5 Then ' drsa.Count < 5 Then
For ii As Integer = coui + 1 To 5 + 1 ' drsa.Count + ki + 1
rtt2.Cells(ii,0).Text = ""
rtt2.Rows(ii).Height = 6
rtt2.Cells(ii,1).Text = ""
rtt2.Cells(ii,2).Text = ""
rtt2.Cells(ii,3).Text = ""
rtt2.Cells(ii,4).Text = ""
rtt2.Cells(ii,5).Text = ""
Next
End If
doc.Body.Children.Add(rtt2)
Dim rt As prt.RenderText
rt = New prt.RenderText() '创建文本对象
rt.x = "Parent.right"
rt.y = 20
rt.Text = "白联 黄联 红联信息 " '设置文本对象的内容
rt.Width = 10 '宽度为35毫米
rt.Height = 60 '高度为15毫米
rt.Style.Spacing.All = 2 '设置各个方向的间隔
rt.Style.Borders.All = New prt.Linedef(1, Color.Red) '设置边框
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
doc.Body.Children.Add(rt) '将容器加入到报表
doc.Preview() '预览