e.Form.Controls("RadioButton1").Select()
Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("统计_table1")
tbl.sort = "单位名称,考试名称,年级代码,班级,折总 desc"
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String()) = tbl.DataTable.GetValues("考试名称|单位名称|年级代码|班级") ''''改后句子
Dim s As Integer = regions.Count
Dim rm As prt.RenderEmpty
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 5 '设置上边距
Doc.PageSetting.BottomMargin = 5 '设置下边距
For Each region As String() In Regions
rm = new prt.RenderEmpty '定义一个新的空对象
rm.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rm)
rx = New prt.RenderText
rx.Style.Font = New Font("黑体", 16, FontStyle.Bold) '
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 2
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Text = Region(1) & Region(0) & Region(2) & "级" & Region(3) & "班成绩表"
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
rt.Width = "auto"
rt.Style.Font = New Font("宋体", 8)
Rows = tbl.DataTable.Select("[单位名称] = '" & region(1) & "'and [班级] ='" & region(3) & "'and [年级代码] ='" & region(2) & "'and [考试名称] ='" & region(0) &"'", "班序")
For c As Integer = 6 To tbl.Cols.Count -1 '
If tbl.Cols(c).Visible Then
If c = 6
rt.Cols(c-6).Width = 12
Else
rt.Cols(c-6).Width = 9
End If
If tbl.Cols(c).Name.Contains("_") Then
Dim Values() As String
Values = tbl.Cols(c).name.split("_")
Dim s As String = values(0) & values(1)
rt.Cells(0,c-6).Text = s
Else
rt.Cells(0,c-6).Text = tbl.Cols(c).Name
End If
Dim r As Integer
For r = 0 To Rows.Count -1
rt.Rows(0).Height = 5
rt.Rows(r+1).height = 4
rt.Cells(r+1,c-6).Text = rows(r)(tbl.Cols(c).Name)
Next
rt.Cells(r+1,0).Text = "班级平均"
rt.Cells(r+2,0).Text = "学校平均"
If "单位名称考试名称年级班级姓名班序校序".Contains(tbl.Cols(c).Name) = False Then
rt.Rows(r+1).height = 6
rt.Rows(r+2).height = 6
rt.Cells(r+1,c-6).Text = format(tbl.DataTable.sqlCompute("Avg(" & tbl.Cols(c).Name & ")","[单位名称] = '" & region(1) & "'and [班级] ='" & region(3) & "'and [年级代码] ='" & region(2) & "'and [考试名称] ='" & region(0) & "'"),"#.00")
rt.Cells(r+2,c-6).Text = format(tbl.DataTable.sqlCompute("Avg(" & tbl.Cols(c).Name & ")","[单位名称] = '" & region(1) & "'and [年级代码] ='" & region(2) & "'and [考试名称] ='" & region(0) & "'"),"#.00")
End If
End If
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Next
doc.preview()
老师,我想将班级平均改为全校的各班平均都列出来,学校平均放在最后,请问怎么改?