类似这种东东用专业报表不是更简单?
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 ra As New prt.RenderArea '定义一个容器
Dim s,s1,s2 As String '定义字符变量
ra.CanSplitVert = False '禁止容器因为分页而被垂直分割
Dim rt As prt.RenderText '定义一个文本对象
s = " ".PadLeft(4)&"高二"& rw("班级")&"班 " & rw("姓名") & ":" & Chr(13) & Chr(10)
s = s & " 在半期考试中,你荣获年级前茅,特发此证,以资鼓励."& Chr(13) & Chr(10)
s = s & " ".PadLeft(40)& "高2010级年级组"& Chr(13) & Chr(10)
s = s & " ".PadLeft(42)& "2010年1月9日"
For ii As Integer = 1 to 2
Dim rx As New prt.RenderText '定义一个文本对象
'加入标题
rx.text = "奖 状"
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 48 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rx.Style.Spacing.Bottom = 3 '和下面的对象(表格)距离3毫米
ra.Children.Add(rx) '加入到容器中
rt = New prt.RenderText
rt.Text = s '设置文本对象的内容
rt.Style.TextIndent = 9 '首行缩进9毫米
rt.Style.Spacing.Top = 5 '每段间隔5毫米
rt.Style.LineSpacing = 150 '1.5倍行距
rt.Style.FontSize = 22
ra.Children.Add(rt) '加入到容器中
rt.Style.Spacing.Bottom = 30
Next
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
Next
Doc.Preview() '预览报表