Foxtable(狐表)用户栏目专家坐堂 → [求助]晕了!分组打印和打印部分列


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

主题:[求助]晕了!分组打印和打印部分列

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/12/20 14:37:00 [显示全部帖子]

其实很简单,通过Table的Filter属性获取筛选条件:

 

Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("记录")
'Dim Date As String = e.Form.Controls("日期").Value
Dim Rows As List(Of DataRow)
Dim Datas As List(Of String) = tbl.DataTable.GetValues("日期",tbl.Filter)
doc.Pagesetting.LandScape = True
For Each Data As String In Datas
    rx = New prt.RenderText
    rx.Style.FontSize = 14
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 2
    rx.Text = "日期: " & Data
    doc.Body.Children.Add(rx)
    rt = New prt.RenderTable
    rt.Style.Font = Tables("记录").Font
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray)
    rt.Style.Spacing.Bottom = 5
    rt.CellStyle.Spacing.All = 1
    rt.Style.Font = tbl.Font
    If tbl.Filter = "" Then
        Rows = tbl.DataTable.Select("[日期] = '" & Data & "'")
    Else
        Rows = tbl.DataTable.Select("[日期] = '" & Data & "' And (" & tbl.Filter & ")")
    End If

    For c As Integer = 0 To tbl.Cols.Count - 1
        rt.Cells(0,c).Text = tbl.Cols(c).Name
        rt.Cols(c).Width = tbl.Cols(c).PrintWidth
        For r As Integer = 0 To Rows.Count -1
            rt.Cells(r + 1, c).Text = rows(r)(tbl.Cols(c).Name)
        Next
    Next
    rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
    doc.Body.Children.Add(rt)
Next
doc.preview()


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/12/20 14:47:00 [显示全部帖子]

我已经用红色标出了不同的地方


 回到顶部