Dim Ls As New List(of String) '定义一个字符集
Dim Ls1 As String() = {"Accounts","From To","Monthly","Total"} '定义一个字符數組
Ls.AddRange(Ls1)
Ls.Add("Rental")
Ls.Add("01/11/2011 - 31/12/2011")
Ls.Add("HK$888.00")
Ls.Add("HK$1,776.00")
Dim doc As New PrintDoc '定义一个报表
Dim rt,rt1,rt2,rt3,rt4,rt5,rt6,rt7,rt8,rtn As New prt.RenderTable() '定义多个表格对象
Dim lrts() As prt.RenderTable ={rt1,rt2,rt3,rt4,rt5,rt6,rt7,rt8} '定义一个表格对象數組
Dim xs() As Double ={0.5,36,86.5,117,0.5,36,86.5,117} '定义各列X坐標
Dim ys() As Double ={0.5,0.5,0.5,0.5,12,12,12,12} '定义各列Y坐標
Dim ws() As Double ={35,50,30,55,35,50,30,55} '定义各列列寬
rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rt.Width = 173.2 '表宽
rt.Height = 24.1 '表高
Dim ra As prt.RenderArea '定义一个容器
ra = rt.Cells(0,0).Area '引用单元格的容器
ra.Stacking = prt.StackingRulesEnum.InlineLeftToRight '排列方式改为从左到右
For n As Integer = 0 To 7
rtn=lrts(n)
rtn.Style.GridLines.All = New prt.Linedef(Color.Gray) '灰色网格线
rtn.x=xs(n)
rtn.y=ys(n)
rtn.Width = ws(n) '列宽
rtn.Height = 11
Dim wt As New prt.RenderText '定义一个文本对象
wt.Text = Ls(n)
wt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
wt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
wt.Style.Font = New Font("宋体",12) '設置字體
rtn.Cells(0, 0).RenderObject = wt '加入表格
ra.Children.Add(rtn) '加入容器
Next
doc.Body.Children.Add(rt) '加入報表
Doc.Preview() '预览报表