Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("订单"))
g.Groups.AddDef("产品")
g.Totals.AddDef("数量")
g.FromServer = True
dt = g.Build(True)
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
For Each Col As DataCol In Dt.DataCols
rt.Cells(0,Count).Text = Col.Name
If Col.IsNumeric Then
rt.Cols(count).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
End If
For r As Integer = 0 To dt.DataRows.Count - 1
rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
Next
Count = Count + 1
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()
[此贴子已经被作者于2017/5/24 8:43:30编辑过]