Foxtable(狐表)用户栏目专家坐堂 → [求助] 如何在报表中每页都能显示表格标题


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

主题:[求助] 如何在报表中每页都能显示表格标题

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


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

用行组,标题和表头一做,你在命令窗口执行下面的代码:

 

 

Dim doc  As New PrintDoc  '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.Linedef  '设置网格线
rt.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
rt.cells(2,0).Text = "第一季度"  '设置第一行第一个单元格的内容
rt.Cells(2,3).Text = "第二季度"  '设置第一行第四个单元格的内容
rt.cells(2,0).SpanCols = 3  '合并第一行前三个单元格
rt.Cells(2,3).SpanCols = 3  '合并第一行最后三个单元格
rt.Cells(3,0).Text= "华东"
rt.Cells(3,1).Text = "华南"
rt.Cells(3,2).Text = "华北"
rt.Cells(3,3).Text= "华东"
rt.Cells(3,4).Text = "华南"
rt.Cells(3,5).Text = "华北"
rt.Cells(0,0).text = "我的大标题"
rt.Cells(0,0).SpanCols = 6
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white)
rt.Cells(1,0).text = "                          我的子标题"
rt.Cells(1,0).SpanCols = 6
rt.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Rows(1).Style.Borders.All = New prt.LineDef("0mm", Color.white)
rt.Rows(1).Style.Borders.Bottom = New prt.Linedef
rt.RowGroups(0,4).Header = prt.TableHeaderEnum.All  '前四行作为表头
rt.RowGroups(2,2).Style.BackColor = Color.LightGray '第三第四行的颜色设为灰色
rt.RowGroups(2,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第三第四行的文本水平居中
rt.RowGroups(2,2).Style.TextAlignVert = prt.AlignVertEnum.Center '第三第四行的文本垂直居中
For i As Integer =  2  To  100 '增加100行
    rt.Cells(i + 2,  0).Text = i
 Next
 Doc.Preview() '预览报表

 

 


 回到顶部