Foxtable(狐表)用户栏目专家坐堂 → 分组打印 列控制


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

主题:分组打印 列控制

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


加好友 发短信
等级:九尾狐 帖子:2482 积分:22932 威望:0 精华:0 注册:2011/3/29 17:14:00
分组打印 列控制  发帖心情 Post By:2021/3/13 23:00:00 [只看该作者]

Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("订单明细")
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetValues("区域") 
doc.Pagesetting.LandScape = True
For Each Region As String In Regions
    rx = New prt.RenderText
    rx.Style.FontSize = 14
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 2
    rx.Text = "区域: " & Region
    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
    Rows = tbl.DataTable.Select("[区域] = '" & Region & "'")
    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


加好友 发短信
等级:超级版主 帖子:111393 积分:567029 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/3/14 20:25:00 [只看该作者]

Dim Cols1() As String = {"来源列一","来源列二","来源列三"}
    Rows = tbl.DataTable.Select("[区域] = '" & Region & "'")
    For c As Integer = 0 To Cols1.length - 1
        rt.Cells(0,c).Text = Cols1(c)
        rt.Cols(c).Width = tbl.Cols(Cols1(c)).PrintWidth
        For r As Integer = 0 To Rows.Count -1 
            rt.Cells(r + 1, c).Text = rows(r)(Cols1(c))
        Next
    Next

 回到顶部