Dim doc As New PrintDoc
Dim tb As Table = Tables("表A")
Dim prs As Integer = 69
Dim caps() As String = {"序号", "姓名", "签字", "序号", "姓名", "签字", "序号", "姓名", "签字"}
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
Dim rx As New prt.RenderText
rx.Text = "公司活动签名表"
rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Style.Spacing.Bottom = 3
Doc.body.Children.Add(rx)
Dim rt As New prt.RenderTable
rt.Cols.Count = 9
rt.Cols(0).Width = 10 '设置各列宽度
rt.Cols(1).Width = 15
rt.Cols(2).Width = 20
rt.Cols(3).Width = 10
rt.Cols(4).Width = 15
rt.Cols(5).Width = 20
rt.Cols(6).Width = 10
rt.Cols(7).Width = 15
rt.Cols(8).Width = 20
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 0.5
rt.Cells(0, 0).SpanCols = 2
rt.Cells(0, 0).Text = "企业名称"
rt.Cells(0, 2).SpanCols = 3
rt.Cells(0, 2).Text = "xxx" 'rw("企业名称")
rt.Cells(0, 5).SpanCols = 2
rt.Cells(0, 5).Text = "活动日期"
rt.Cells(0, 7).SpanCols = 2
rt.Cells(0, 7).Text = "2022-05-22" 'rw("培训时间")
rt.Cells(1, 0).SpanCols = 2
rt.Cells(1, 0).Text = "培训主题"
rt.Cells(1, 2).SpanCols = 7
rt.Cells(1, 2).Text = "xxx" 'rw("培训主题")
Dim idx As Integer = 2
For c As Integer = 0 To caps.Length - 1
rt.Cells(idx, c).Text = caps(c)
Next
idx = 3
Dim cl As Integer = 0
Dim i As Integer = 1
For r As Integer = p * prs To math.min(tb.Rows.Count - 1, ( p + 1) * prs - 1)
If idx >= 26 Then
idx = 3
cl = cl + 3
End If
rt.Cells(idx, cl).Text = i
rt.Cells(idx, cl + 1).Text = tb.rows(r)("姓名")
idx += 1
i += 1
Next
If p < math.Ceiling(tb.Rows.Count / prs) - 1 Then
rt.BreakAfter = prt.BreakEnum.Page
End If
doc.Body.Children.Add(rt)
Next
doc.Preview()