Foxtable(狐表)用户栏目专家坐堂 → 打印或打印预览时相同的行只显示一行


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

主题:打印或打印预览时相同的行只显示一行

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


加好友 发短信
等级:小狐 帖子:364 积分:3491 威望:0 精华:0 注册:2012/7/24 7:15:00
打印或打印预览时相同的行只显示一行  发帖心情 Post By:2021/4/23 6:57:00 [只看该作者]

在打印或预览时,让列“风险点_名称”内容相同的行只显示一行。
现在是相同的行都显示,如下图:

图片点击可在新窗口打开查看此主题相关图片如下:捕获.jpg
图片点击可在新窗口打开查看
现在代码如下:
......
 '设置检查表表格样式
    rt9 = New prt.RenderTable
    rt9.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt9.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
    rt9.Style.Spacing.Bottom = 2
    rt9.CellStyle.Spacing.All = 1
    rt9.Style.Font = New Font("宋体", 11)
    '设置检查表表格细节
    Rows9 = tbl8.DataTable.Select("企业名称 Like '*" & Forms("mainform").controls("combobox13").value & "*' and 公司级综合 = true and 作业步骤或检查项目_类型 = '安全生产' and 管控措施_内容 <> '无'","风险点_名称")  '指定符合条件的行和排序方式
    Dim nms9() As String = {"风险点_编号","风险点_名称","检查结果_符合性","备注","备注","备注"} '指定要显示的列即要打印的列
    Dim caps9() As String = {"序号","风险点_名称","检查结果","问题描述","整改责任人","整改时限"} '自定义列名
    For c As Integer = 0 To nms9.length - 1
        Dim ary() As String = caps9(c).split("|")
        For i As Integer = 0 To ary.length-1
            rt9.cells(i, c).text = ary(i)
        Next    '打印的列标题自定义
        rt9.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
        rt9.Cols(0).Width = 15 '设置各列宽度
        rt9.Cols(1).Width = 40
        rt9.Cols(2).Width = 20
        rt9.Cols(3).Width = 160
        rt9.Cols(4).Width = 25
        rt9.Cols(5).Width = 20
        For r As Integer = 0 To Rows9.Count -1
            If c=0 Then
                rt9.Cells(r + 1, c).Text = r+1 '增加了序号列,并自动填充
            ElseIf tbl8.Cols(nms9(c)).IsBoolean
                If Rows9(r)(tbl8.Cols(nms9(c)).Name) = False
                    rt9.Cells(r + 1, c).Text = ""
                End If
            Else
                rt9.Cells(r + 1, c).Text = rows9(r)(tbl8.Cols(nms9(c)).Name)
            End If
            rt9.Rows(r+1).Height = 20 '设置行的高度
        Next
    Next
    rt9.RowGroups(0,1).Header = prt.TableHeaderEnum.All
    doc.Body.Children.Add(rt9)


请老师帮忙看一下,如何改一下代码。谢谢

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107672 积分:547681 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/4/23 8:52:00 [只看该作者]

 '设置检查表表格样式
    rt9 = New prt.RenderTable
    rt9.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt9.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
    rt9.Style.Spacing.Bottom = 2
    rt9.CellStyle.Spacing.All = 1
    rt9.Style.Font = New Font("宋体", 11)
    '设置检查表表格细节
Dim dr As DataRow
Dim filter As String = "企业名称 Like '%" & Forms("mainform").controls("combobox13").value & "%' and 公司级综合 = true and 作业步骤或检查项目_类型 = '安全生产' and 管控措施_内容 <> '无'"
Dim Products As List(Of String) = tbl8.DataTable.getvalues("风险点_名称",filter)  
    'Rows9 = tbl8.DataTable.Select("企业名称 Like '*" & Forms("mainform").controls("combobox13").value & "*' and 公司级综合 = true and 作业步骤或检查项目_类型 = '安全生产' and 管控措施_内容 <> '无'","风险点_名称")  '指定符合条件的行和排序方式
    Dim nms9() As String = {"风险点_编号","风险点_名称","检查结果_符合性","备注","备注","备注"} '指定要显示的列即要打印的列
    Dim caps9() As String = {"序号","风险点_名称","检查结果","问题描述","整改责任人","整改时限"} '自定义列名
    For c As Integer = 0 To nms9.length - 1
        Dim ary() As String = caps9(c).split("|")
        For i As Integer = 0 To ary.length-1
            rt9.cells(i, c).text = ary(i)
        Next    '打印的列标题自定义
        rt9.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
        rt9.Cols(0).Width = 15 '设置各列宽度
        rt9.Cols(1).Width = 40
        rt9.Cols(2).Width = 20
        rt9.Cols(3).Width = 160
        rt9.Cols(4).Width = 25
        rt9.Cols(5).Width = 20
        For r As Integer = 0 To Products.Count -1
dr = tbl8.DataTable.find("风险点_名称 = '" & Products(r) & "' And " & filter )  
If dr Is Nothing Then Continue For
            If c=0 Then
                rt9.Cells(r + 1, c).Text = r+1 '增加了序号列,并自动填充
            ElseIf tbl8.Cols(nms9(c)).IsBoolean
                If dr(nms9(c)) = False
                    rt9.Cells(r + 1, c).Text = ""
                End If
            Else
                rt9.Cells(r + 1, c).Text = dr(nms9(c))
            End If
            rt9.Rows(r+1).Height = 20 '设置行的高度
        Next
    Next
    rt9.RowGroups(0,1).Header = prt.TableHeaderEnum.All
    doc.Body.Children.Add(rt9)

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


加好友 发短信
等级:小狐 帖子:364 积分:3491 威望:0 精华:0 注册:2012/7/24 7:15:00
  发帖心情 Post By:2021/4/29 6:03:00 [只看该作者]

收到,谢谢

 回到顶部