Foxtable(狐表)用户栏目专家坐堂 → 专业报表 设置行高问题


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

主题:专业报表 设置行高问题

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


加好友 发短信
等级:五尾狐 帖子:1172 积分:8772 威望:0 精华:0 注册:2012/4/18 16:28:00
专业报表 设置行高问题  发帖心情 Post By:2017/8/16 16:11:00 [只看该作者]

请教老师,下面代码,行高只能设置多层表头以下的前三行的行高,后面的多个行的行高设置无效果?

 

另外,统计表SQLGroup...生成的合计行,怎样在专业报表中显示出来?

 

Dim rt4 As New prt.RenderTable '定义一个新表格
Dim tb4 As Table = Tables("员工信息_Table4")
Dim hd4 As Integer = tb4.HeaderRows '获得表头的层数
rt4.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
rt4.Width = "Auto" '表格宽度为自动,也就是等于各列设置宽度之和
rt4.Style.Font = tb4.Font
tb4.CreateReportHeader(rt4,False) '生成表头,包括所有列
For c As Integer = 0 To tb4.Cols.Count -1 '逐列设置和填入内容
     rt4.Cols(c).Width = tb4.Cols(c).PrintWidth '列宽等于实际列宽
    If tb4.Cols(c).IsNumeric OrElse tb4.Cols(c).IsDate Then '如果是数值或日期列
        rt4.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
    End If
    For r As Integer = 0 To tb4.Rows.Count -1 '开始填入该列内容
        rt4.Cells(r + hd4, c).Text = tb4(r,c)
    Next
Next
For i As Integer = 0 To tb4.Rows.Count -1
    rt4.Rows(i).Height = 8 '设置行高
Next

rt4.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt4.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt4.Cols(0).Width = 30 '设置列宽
rt4.RowGroups(0,2).Style.BackColor = Color.PaleTurquoise '前两行的颜色设为灰色
rt4.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt4.CellStyle.Spacing.All = 0.5 '单元格内距设为0.5毫米
rt4.RowGroups(0, tb4.HeaderRows).Header = prt.TableHeaderEnum.All '利用行组功能设置表头
doc.Body.Children.Add(rt4) '将表格加入到报表

[此贴子已经被作者于2017/8/16 16:24:05编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/16 16:47:00 [只看该作者]

1、

 

For i As Integer = 0 To tb4.Rows.Count -1
    rt4.Rows(i+tb4.HeaderRows).Height = 28 '设置行高
Next

 

2、

 

Dim doc As new PrintDoc
Dim rt4 As New prt.RenderTable '定义一个新表格
Dim tb4 As Table = Tables("表A")
Dim hd4 As Integer = tb4.HeaderRows '获得表头的层数
rt4.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
rt4.Width = "Auto" '表格宽度为自动,也就是等于各列设置宽度之和
rt4.Style.Font = tb4.Font
tb4.CreateReportHeader(rt4,False) '生成表头,包括所有列
For c As Integer = 0 To tb4.Cols.Count -1 '逐列设置和填入内容
    rt4.Cols(c).Width = tb4.Cols(c).PrintWidth '列宽等于实际列宽
    If tb4.Cols(c).IsNumeric OrElse tb4.Cols(c).IsDate Then '如果是数值或日期列
        rt4.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
    End If
    For r As Integer = 0 To tb4.Rows.Count -1 '开始填入该列内容
        rt4.Cells(r + hd4, c).Text = tb4(r,c)
    Next
Next
If tb4.GrandTotal Then
    rt4.Cells(tb4.count+tb4.HeaderRows, 0).Text = "合计"
End If
For c As Integer = 0 To tb4.Cols.Count -1 '逐列设置和填入内容
    If tb4.Cols(c).GrandTotal Then '如果是数值或日期列
        rt4.Cells(tb4.count+tb4.HeaderRows, c).Text = tb4.compute("sum(" & tb4.cols(c).name & ")")
    End If
next
For i As Integer = 0 To tb4.Rows.Count -1
    rt4.Rows(i+tb4.HeaderRows).Height = 28 '设置行高
Next

rt4.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt4.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
rt4.Cols(0).Width = 30 '设置列宽
rt4.RowGroups(0,2).Style.BackColor = Color.PaleTurquoise '前两行的颜色设为灰色
rt4.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt4.CellStyle.Spacing.All = 0.5 '单元格内距设为0.5毫米
rt4.RowGroups(0, tb4.HeaderRows).Header = prt.TableHeaderEnum.All '利用行组功能设置表头
doc.Body.Children.Add(rt4) '将表格加入到报表
doc.Preview


 回到顶部