此主题相关图片如下:4.jpg
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("fenfa"))
g.Groups.AddDef("faby","投递员")
g.Groups.AddDef("baom","报刊名称")
g.Totals.AddDef("fens","份数")
g.Filter = "[zzrq] >= '1/1/2012 ' And [zzrq] <= '12/31/2012 ' And [pian] = '城西 '"
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
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
rt.Style.Font = New Font("宋体", 20, FontStyle.Bold) '设置字体
rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rt.Height = 710 '设置表格的高度为120毫米
rt.Cells(1,0).SpanRows = 2
rt.Cells(3,0).SpanRows = 2
rt.Cells(5,0).SpanRows = 2
rt.Cells(7,0).SpanRows = 2
rt.Cells(9,0).SpanRows = 2
rt.Cells(11,0).SpanRows = 2
rt.Cells(13,0).SpanRows = 2
rt.Cells(15,0).SpanRows = 2
rt.Cells(17,0).SpanRows = 2
rt.Cells(19,0).SpanRows = 2
rt.Cells(21,0).SpanRows = 2
rt.Cells(23,0).SpanRows = 2
rt.Cells(25,0).SpanRows = 2
rt.Cells(27,0).SpanRows = 2
rt.Cells(29,0).SpanRows = 2
rt.Cells(31,0).SpanRows = 2
rt.Cells(33,0).SpanRows = 2
rt.Cells(35,0).SpanRows = 2
rt.Cells(37,0).SpanRows = 2
rt.Cells(39,0).SpanRows = 2
rt.Cells(41,0).SpanRows = 2
rt.Cells(43,0).SpanRows = 2
rt.Cells(45,0).SpanRows = 2
rt.Cells(47,0).SpanRows = 2
rt.Cells(49,0).SpanRows = 2
rt.Cells(51,0).SpanRows = 2
rt.Cells(53,0).SpanRows = 2
rt.Cells(55,0).SpanRows = 2
rt.Cells(57,0).SpanRows = 2
rt.Cells(59,0).SpanRows = 2
rt.Cells(61,0).SpanRows = 2
rt.Cells(63,0).SpanRows = 2
rt.Cells(65,0).SpanRows = 2
rt.Cells(67,0).SpanRows = 2
rt.Cells(69,0).SpanRows = 2
rt.Cells(71,0).SpanRows = 2
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
rt.Rows(0).Style.TextAlignVert = prt.AlignVertEnum.Center '第一行内容垂直居中
rt.Rows(0).Style.BackColor = Color.LightGray '第一行背景颜色设为灰色.
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All '将第一行作为表头.
doc.Body.Children.Add(rt)
doc.Preview()
原代码如上。
但是打印出来太多页数了,我想变成如下效果的统计,请问高手,如何写代码呀