Foxtable(狐表)用户栏目专家坐堂 → 求解:专业报表设计中 设计的行数是21行 排除两行作为表头 那么余下19行有效打印区 当数据大于19时候,报表不另行第二页开始打印 而是直接在第一个表中打印所有的表行数据 求解!


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

主题:求解:专业报表设计中 设计的行数是21行 排除两行作为表头 那么余下19行有效打印区 当数据大于19时候,报表不另行第二页开始打印 而是直接在第一个表中打印所有的表行数据 求解!

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 10:11:00 [显示全部帖子]


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 14:32:00 [显示全部帖子]


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 14:55:00 [显示全部帖子]

 那就学习啊,你要全部帮你写好么?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 15:09:00 [显示全部帖子]

 代码

 

Dim doc As New PrintDoc '定义一个报表
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("卷内目录")


Doc.PageSetting.LeftMargin = 30 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 25 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
doc.PageSetting.Width = 210 '纸张宽度为100毫米
doc.PageSetting.Height = 295 '纸张高度为120毫米
Doc.Style.Padding.right = 1
Doc.Style.Padding.Left = 1

 

Dim prs As Integer = 20 '每页20行
Dim idx As Integer = 0
For i As Integer = tbl.TopRow To tbl.BottomRow
    Rows = Tables("卷宗封面").Rows(i).DataRow.GetChildRows("卷内目录")
    Dim rt As prt.RenderTable
    For r As Integer = 0 To Rows.Count - 1
        If idx Mod prs = 0 Then
            Dim rs As New prt.RenderText() '定义一个文本对象
            rt = New prt.RenderTable
            rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
            rs.Text = "卷内目录表"  '设置文本对象的内容
            rs.Style.Font = New Font("宋体", 24 , FontStyle.Bold) '设置文本对象的字体
            rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
            doc.Body.Children.Add(rs) '将文本对象加入到表格中
            'doc.Body.Children.Add(rt) '将表格对象加入到报表中
            rt.Style.GridLines.All = New prt.Linedef '设置网格线
            rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All
           
            rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
            'rt.Width = "Auto"
            rt.Cols(0).Width = 10 '设置列宽
            rt.Cols(1).Width = 20 '设置列宽
            rt.Cols(2).Width = 20 '设置列宽
            rt.Cols(3).Width = 20 '设置列宽
            rt.Cols(4).Width = 15 '设置列宽
            rt.Cols(5).Width = 50 '设置列宽
            rt.Cols(6).Width = 10 '设置列宽
            rt.Cols(7).Width = 10 '设置列宽
            rt.Cols(8).Width = 20 '设置列宽
           
           
            rt.Rows.Count = 21 '设置总行数
            rt.Cols.Count = 9 '设置总列数
            rt.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
            rt.Style.Spacing.Bottom = 10 '表和和后续对象的垂直间隔为10毫米
           
           
            rt.Height = 235 '设置表格的高度为120毫米
            rt.Cells(0,3).SpanCols = 2 '第5行第2个单元格向右合并3列
            rt.Cells(0,0).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,1).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,4).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,5).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,6).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,7).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,2).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,8).SpanRows = 2 '第1行第5个单元格向下合并6行
           
            rt.Cells(0,0).Text= "序号"
            rt.Cells(0,0).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,1).Text = "来源"
            rt.Cells(0,2).Text = "责任人"
            rt.Cells(0,3).Text= "文件编号"
            rt.Cells(1,3).Text= "字号"
            rt.Cells(1,4).Text= "文号"
            rt.Cells(0,4).Text = "标题"
            rt.Cells(0,5).Text = "标题"
            rt.Cells(0,6).Text = "起始页"
            rt.Cells(0,7).Text = "结束页"
            rt.Cells(0,8).Text = "备注"
           
            rt.Cells(0,1).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,2).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,3).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,4).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,5).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,6).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,7).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,8).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(1,3).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(1,4).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All '前两行作为表头
            'rt.RowGroups(0,2).Style.BackColor = Color.LightGray '前两行的颜色设为灰色
            rt.RowGroups(0,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center '前两行的文本水平居中
            rt.RowGroups(0,2).Style.TextAlignVert = prt.AlignVertEnum.Center '前两行的文本垂直居中
            idx = 0
            Doc.Body.Children.Add(rt)
        End If
       
       
        rt.Cells(idx+2,0).Text = rows(r)("序号")
        rt.Cells(idx+2,1).Text = rows(r)("来源")
        rt.Cells(idx+2,2).Text = rows(r)("责任人")
        rt.Cells(idx+2,3).Text = rows(r)("材料编号_字号")
        rt.Cells(idx+2,4).Text = rows(r)("材料编号_文号")
        rt.Cells(idx+2,5).Text = rows(r)("标题")
        rt.Cells(idx+2,6).Text = rows(r)("起始页")
        rt.Cells(idx+2,7).Text = rows(r)("结束页")
        rt.Cells(idx+2,8).Text = rows(r)("备注")
       
        idx += 1
    Next
    'End With
Next

Dim rx As New prt.RenderTable
'rx.Cells(0,0).Text = Date.Today
'rx.Cells(0,1).Text = "抗震救灾专题"
rx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
'rx.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx.Style.FontSize = 8 '字体大小为8磅
Doc.PageFooter=rx '作为页眉使用

 


Doc.Preview() '预览报表


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 15:10:00 [显示全部帖子]

看8楼。

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 15:49:00 [显示全部帖子]

 不理解你的意思,你本来就是把选定的行的子表数据打印出来啊。

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 16:45:00 [显示全部帖子]

     

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:卷宗.rar


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 17:54:00 [显示全部帖子]

   
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:卷宗.rar


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/3 19:54:00 [显示全部帖子]

Dim doc As New PrintDoc '定义一个报表
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("卷宗封面")

Doc.PageSetting.LeftMargin = 30 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 25 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
doc.PageSetting.Width = 210 '纸张宽度为100毫米
doc.PageSetting.Height = 295 '纸张高度为120毫米
Doc.Style.Padding.right = 1
Doc.Style.Padding.Left = 1

Dim prs As Integer = 20 '每页20行
Dim idx As Integer = 0
For i As Integer = tbl.TopRow To tbl.BottomRow
    Rows = Tables("卷宗封面").Rows(i).DataRow.GetChildRows("卷内目录")
   
    Dim rt As prt.RenderTable
    For r As Integer = 0 To Rows.Count - 1
        If idx Mod prs = 0 Then
            Dim rs As New prt.RenderText() '定义一个文本对象
            rt = New prt.RenderTable
            rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
            rs.Text = "卷内目录表"  '设置文本对象的内容
            rs.Style.Font = New Font("宋体", 24 , FontStyle.Bold) '设置文本对象的字体
            rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
            doc.Body.Children.Add(rs) '将文本对象加入到表格中
            'doc.Body.Children.Add(rt) '将表格对象加入到报表中
            rt.Style.GridLines.All = New prt.Linedef '设置网格线
            rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All
           
            rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
            'rt.Width = "Auto"
            rt.Cols(0).Width = 10 '设置列宽
            rt.Cols(1).Width = 20 '设置列宽
            rt.Cols(2).Width = 20 '设置列宽
            rt.Cols(3).Width = 20 '设置列宽
            rt.Cols(4).Width = 15 '设置列宽
            rt.Cols(5).Width = 50 '设置列宽
            rt.Cols(6).Width = 10 '设置列宽
            rt.Cols(7).Width = 10 '设置列宽
            rt.Cols(8).Width = 20 '设置列宽
           
           
            rt.Rows.Count = 21 '设置总行数
            rt.Cols.Count = 9 '设置总列数
            rt.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
            rt.Style.Spacing.Bottom = 10 '表和和后续对象的垂直间隔为10毫米
           
           
            rt.Height = 235 '设置表格的高度为120毫米
            rt.Cells(0,3).SpanCols = 2 '第5行第2个单元格向右合并3列
            rt.Cells(0,0).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,1).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,4).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,5).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,6).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,7).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,2).SpanRows = 2 '第1行第5个单元格向下合并6行
            rt.Cells(0,8).SpanRows = 2 '第1行第5个单元格向下合并6行
           
            rt.Cells(0,0).Text= "序号"
            rt.Cells(0,0).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,1).Text = "来源"
            rt.Cells(0,2).Text = "责任人"
            rt.Cells(0,3).Text= "文件编号"
            rt.Cells(1,3).Text= "字号"
            rt.Cells(1,4).Text= "文号"
            rt.Cells(0,4).Text = "标题"
            rt.Cells(0,5).Text = "标题"
            rt.Cells(0,6).Text = "起始页"
            rt.Cells(0,7).Text = "结束页"
            rt.Cells(0,8).Text = "备注"
           
            rt.Cells(0,1).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,2).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,3).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,4).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,5).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,6).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,7).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(0,8).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(1,3).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.Cells(1,4).Style.Font=New Font("宋体", 16, FontStyle.Bold)
            rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All '前两行作为表头
            'rt.RowGroups(0,2).Style.BackColor = Color.LightGray '前两行的颜色设为灰色
            rt.RowGroups(0,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center '前两行的文本水平居中
            rt.RowGroups(0,2).Style.TextAlignVert = prt.AlignVertEnum.Center '前两行的文本垂直居中
            idx = 0
            Doc.Body.Children.Add(rt)
        End If
       
        rt.Cells(idx+2,0).Text = rows(r)("序号")
        rt.Cells(idx+2,1).Text = rows(r)("来源")
        rt.Cells(idx+2,2).Text = rows(r)("责任人")
        rt.Cells(idx+2,3).Text = rows(r)("材料编号_字号")
        rt.Cells(idx+2,4).Text = rows(r)("材料编号_文号")
        rt.Cells(idx+2,5).Text = rows(r)("标题")
        rt.Cells(idx+2,6).Text = rows(r)("起始页")
        rt.Cells(idx+2,7).Text = rows(r)("结束页")
        rt.Cells(idx+2,8).Text = rows(r)("备注")
        idx += 1
       
    Next
Next
Dim rx As New prt.RenderTable
'rx.Cells(0,0).Text = Date.Today
'rx.Cells(0,1).Text = "抗震救灾专题"
rx.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
'rx.Style.Borders.Bottom = New prt.LineDef '设置底边框
rx.CellStyle.Spacing.Bottom = 0.5 '底端内容缩进0.5毫米
rx.Style.FontSize = 8 '字体大小为8磅
Doc.PageFooter=rx '作为页眉使用


Doc.Preview() '预览报表


 回到顶部