Foxtable(狐表)用户栏目专家坐堂 → 分组


  共有2712人关注过本帖树形打印复制链接

主题:分组

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110581 积分:562801 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/11/17 15:28:00 [显示全部帖子]

Dim bu As new StringBuilder
Dim idx As Integer = 1
For Each c As Col In Tables("报名表").Cols
    If c.Name.Contains("男") OrElse c.Name.Contains("女")
        Dim drs As List(of DataRow) = DataTables("报名表").Select("班级 like '%七年级%' and " & c.Name & " = '√'", "班级")
        If drs.Count = 0 Then Continue For
        Dim ls1 As new List(of String)
        Dim ls2 As new List(of String)
        Dim ls3 As new List(of String)
        For i As Integer = 0 To drs.count-1 Step 3
            ls1.add(drs(i)("号码"))
            If i+1 < drs.count Then ls2.add(drs(i+1)("号码"))
            If i+2 < drs.count Then ls3.add(drs(i+2)("号码"))
        Next
        Dim arr() As String = c.Name.Split("_")
        If arr.Length = 2 Then
            bu.AppendLine("七年级" & arr(1) & "子" & arr(0) & "预赛(共三组)")
        Else
            bu.AppendLine("七年级" & c.Name & "预赛(共三组)")
        End If
         bu.AppendLine("第一组:" & String.Join("      ",ls1.ToArray))
         bu.AppendLine("第二组:" & String.Join("      ",ls2.ToArray))
         bu.AppendLine("第三组:" & String.Join("      ",ls3.ToArray))
    End If
Next

Output.Show(bu.ToString)

Dim tm As String  = ProjectPath & "Attachments\0101.docx" '指定模板文件
Dim fl As String = ProjectPath & "Reports\_0101.docx" '指定目标文件
Dim wrt As New WordReport(Tables("报名表"),tm,fl) '定义一个WordReport
wrt.ReplaceOne("[班级]",bu.ToString)
wrt.BuildOne(Tables("报名表").Current)
wrt.Show() '显示报表

 回到顶部