看红色部分
Dim doc As New PrintDoc
Dim tb as Table = Tables("表A")
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim ColNames As New List(Of String)
For Each cl As Col In tb.Cols '排除隐藏列
If cl.Visible Then
ColNames.Add(cl.Name)
End If
Next
rt.Style.GridLines.All = New prt.Linedef '设置网格线
For c As Integer = 0 To tb.Cols.Count -1
Dim FirstRow As Integer = 1
For r As integer = 0 To tb.Rows.Count -1
If tb(r,c) Is Nothing Then
Continue for
End if
If r > 0 AndAlso c <= 5 AndAlso tb.Cols(c).IsString AndAlso tb(r,c) = tb(r-1,c) Then
rt.Cells(FirstRow,c).SpanRows = rt.Cells(FirstRow,c).SpanRows + 1
Else
rt.Cells(r + 1, c).Text = tb(r,c)
FirstRow = r + 1
End if
Next
Next
doc.Body.Children.Add(rt) '将表格对象加入到报表中
doc.Preview()
[此贴子已经被作者于2009-6-2 16:14:10编辑过]