Foxtable(狐表)用户栏目专家坐堂 → 求解:专业报表设计中 表中数据记录有两条 结果报表预览只显示一条记录 求解!


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

主题:求解:专业报表设计中 表中数据记录有两条 结果报表预览只显示一条记录 求解!

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


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

 你写了这句代码 For i As Integer = tbl.TopRow To tbl.BottomRow

 

 那么,你就要选中要打印的行。不然你就换成 For i As Integer = 0 To tbl.Rows.Count - 1


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


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

 测试没有问题。请写上完整代码。

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


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

 

[此贴子已经被作者于2014-8-3 16:47:56编辑过]

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


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

Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rs As New prt.RenderText() '定义一个文本对象
Dim Currow As Row
Dim tbl As Table = Tables("卷宗封面")

doc.Body.Children.Add(rs) '将文本对象加入到表格中
For i As Integer = tbl.TopRow To tbl.BottomRow
    CurRow = tbl.rows(i)
   
    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
   
    rs.Text = "检察卷移交目录表"  '设置文本对象的内容
    rs.Style.Font = New Font("宋体", 24 , FontStyle.Bold) '设置文本对象的字体
    rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
    '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.Rows.Count = 21 '设置总行数
    rt.Cols.Count = 6 '设置总列数
    rt.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
    rt.Style.Spacing.Bottom = 10 '表和和后续对象的垂直间隔为10毫米
    rt.Cols(0).Width = 10 '设置列宽
    rt.Cols(1).Width = 20 '设置列宽
    rt.Cols(2).Width = 20 '设置列宽
    rt.Cols(3).Width = 20 '设置列宽
    rt.Cols(4).Width = 60 '设置列宽
    rt.Cols(5).Width = 10 '设置列宽
   
    rt.Height = 235 '设置表格的高度为120毫米
    rt.Cells(0,3).SpanCols = 1 '第5行第4个单元格向右合并2列
    rt.Cells(0,0).SpanRows =1 '第1行第1个单元格向下合并2行
    rt.Cells(0,1).SpanRows = 1 '第1行第2个单元格向下合并2行
    rt.Cells(0,4).SpanRows = 1 '第1行第5个单元格向下合并2行
    rt.Cells(0,5).SpanRows = 1 '第1行第6个单元格向下合并2行
    rt.Cells(0,2).SpanRows = 1 '第1行第3个单元格向下合并2行
   
    rt.Cells(0,0).Text= "序号"
    rt.Cells(0,1).Text = "案卷编号"
    rt.Cells(0,2).Text = "人员名称"
    rt.Cells(0,3).Text= "案由"
    rt.Cells(0,4).Text = "处理结果"
    rt.Cells(0,5).Text = "共卷"
   
    rt.Cells(0,0).Style.Font=New Font("宋体", 16, FontStyle.Bold)
    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.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 '前两行的文本垂直居中
   
    ' Rows = Tables("卷宗封面").Rows(i).DataRow.GetChildRows("承办人")
    'For r As Integer = 0 To Rows.Count - 1
    'rt.Cells(i+1,0).Text = CurRow("序号")
    rt.Cells(i+1,1).Text = CurRow("案卷编号")
    rt.Cells(i+1,2).Text = CurRow("人员名称")
    rt.Cells(i+1,3).Text = CurRow("案由")
    rt.Cells(i+1,4).Text = CurRow("处理结果")
    rt.Cells(i+1,5).Text = CurRow("共卷")
Next

 

doc.Body.Children.Add(rt)

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 17:18:00 [显示全部帖子]

Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rs As New prt.RenderText() '定义一个文本对象
Dim Currow As Row
Dim tbl As Table = Tables("卷宗封面")

doc.Body.Children.Add(rs) '将文本对象加入到表格中
Dim i As Integer = 0
For Each r As Row In tbl.GetCheckedRows
    CurRow = r
   
    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
   
    rs.Text = "检察卷移交目录表"  '设置文本对象的内容
    rs.Style.Font = New Font("宋体", 24 , FontStyle.Bold) '设置文本对象的字体
    rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
    '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.Rows.Count = 21 '设置总行数
    rt.Cols.Count = 6 '设置总列数
    rt.Style.Spacing.Top = 4 '表格和前面对象的垂直间隔为4毫米
    rt.Style.Spacing.Bottom = 10 '表和和后续对象的垂直间隔为10毫米
    rt.Cols(0).Width = 10 '设置列宽
    rt.Cols(1).Width = 20 '设置列宽
    rt.Cols(2).Width = 20 '设置列宽
    rt.Cols(3).Width = 20 '设置列宽
    rt.Cols(4).Width = 60 '设置列宽
    rt.Cols(5).Width = 10 '设置列宽
   
    rt.Height = 235 '设置表格的高度为120毫米
    rt.Cells(0,3).SpanCols = 1 '第5行第4个单元格向右合并2列
    rt.Cells(0,0).SpanRows =1 '第1行第1个单元格向下合并2行
    rt.Cells(0,1).SpanRows = 1 '第1行第2个单元格向下合并2行
    rt.Cells(0,4).SpanRows = 1 '第1行第5个单元格向下合并2行
    rt.Cells(0,5).SpanRows = 1 '第1行第6个单元格向下合并2行
    rt.Cells(0,2).SpanRows = 1 '第1行第3个单元格向下合并2行
   
    rt.Cells(0,0).Text= "序号"
    rt.Cells(0,1).Text = "案卷编号"
    rt.Cells(0,2).Text = "人员名称"
    rt.Cells(0,3).Text= "案由"
    rt.Cells(0,4).Text = "处理结果"
    rt.Cells(0,5).Text = "共卷"
   
    rt.Cells(0,0).Style.Font=New Font("宋体", 16, FontStyle.Bold)
    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.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 '前两行的文本垂直居中
   
    ' Rows = Tables("卷宗封面").Rows(i).DataRow.GetChildRows("承办人")
    'For r As Integer = 0 To Rows.Count - 1
    'rt.Cells(i+1,0).Text = CurRow("序号")
    rt.Cells(i+1,1).Text = CurRow("案卷编号")
    rt.Cells(i+1,2).Text = CurRow("人员名称")
    rt.Cells(i+1,3).Text = CurRow("案由")
    rt.Cells(i+1,4).Text = CurRow("处理结果")
    rt.Cells(i+1,5).Text = CurRow("共卷")
    i += 1
Next

 

doc.Body.Children.Add(rt)

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() '预览报表
 

 


 回到顶部