如果不够20行,自动补空行:
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim MinRows As Integer = 20
Dim tb As Table = Tables("表A")
For c As Integer = 0 To tb.Cols.Count -1 '逐列填入内容
rt.Cells(0,c).Text = tb.Cols(c).Name '列名作为标题
For r As Integer = 0 To tb.Rows.Count -1
rt.Cells(r + 1, c).Text = tb(r,c)
Next
IF c = 0 Then '加空行
For r As Integer = tb.Rows.Count To MinRows
rt.Cells(r+1,0).Text = " "
Next
End If
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
doc.Body.Children.Add(rt)
doc.Preview()
[此贴子已经被作者于2010-8-18 8:11:07编辑过]