以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  专业报表 在制表中没有问题 绑定关联表相关操作后,不能生成数据 求纠正!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=54668)

--  作者:李孝春
--  发布时间:2014/8/1 18:51:00
--  专业报表 在制表中没有问题 绑定关联表相关操作后,不能生成数据 求纠正!
专业报表 在制表中没有问题  绑定关联表相关操作后,不能生成数据  求纠正!  同时第二页表中 表标题不显示了?求纠正!
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:卷宗.foxdb



图片点击可在新窗口打开查看此主题相关图片如下:12121.jpg
图片点击可在新窗口打开查看


图片点击可在新窗口打开查看此主题相关图片如下:2223.jpg
图片点击可在新窗口打开查看

点下面两个按钮事件  打开的预览窗体都没有数据 只有表格     纠结中

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20140801203141.jpg
图片点击可在新窗口打开查看



[此贴子已经被作者于2014-8-2 21:27:07编辑过]

--  作者:y2287958
--  发布时间:2014/8/2 8:10:00
--  
看这里
--  作者:李孝春
--  发布时间:2014/8/2 8:27:00
--  回复:(y2287958)看这里http://www.foxtable.com/he...
就是参照的这个 现在主要是数据绑定不能对应显示数据 继续求解
--  作者:李孝春
--  发布时间:2014/8/2 13:53:00
--  
继续求解
--  作者:blackzhu
--  发布时间:2014/8/2 14:08:00
--  
\'Rows = Tables("卷内目录").Rows(i).DataRow.GetChildRows("承办人")  你想获取哪一个表的数据?



你没有承办人这个表呀?
[此贴子已经被作者于2014-8-2 14:08:53编辑过]

--  作者:don
--  发布时间:2014/8/2 14:19:00
--  
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("卷宗封面")

Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rs As New prt.RenderText() \'定义一个文本对象
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 = 10 \'设置列宽
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行
For i As Integer = tbl.TopRow To tbl.BottomRow
    
    rt.Cells(0,0).Text= "序号"
    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.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(r+2,0).Text = rows(r)("序号")
        rt.Cells(r+2,1).Text = rows(r)("来源")
        rt.Cells(r+2,2).Text = rows(r)("责任人")
        rt.Cells(r+2,3).Text = rows(r)("材料编号_字号")
        rt.Cells(r+2,4).Text = rows(r)("材料编号_文号")
        rt.Cells(r+2,5).Text = rows(r)("标题")
        rt.Cells(r+2,6).Text = rows(r)("起始页")
        rt.Cells(r+2,7).Text = rows(r)("结束页")
        rt.Cells(r+2,8).Text = rows(r)("备注")
        
    Next
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() \'预览报表


--  作者:李孝春
--  发布时间:2014/8/2 21:27:00
--  回复:(李孝春)专业报表 在制表中没有问题 绑定关联...
rt.Rows.Count = 21 \'设置总行数   设定的是21行数据 结果关联表有35行数据 该表不会自动换页 打印 纠结中

图片点击可在新窗口打开查看此主题相关图片如下:121212.jpg
图片点击可在新窗口打开查看

代码如下:


Dim doc As New PrintDoc \'定义一个报表
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("卷内目录")
Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rs As New prt.RenderText() \'定义一个文本对象

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(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 \'设置总行数   设定的是21行数据 结果关联表有35行数据 该表不会自动换页 打印 纠结中
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 \'前两行的文本垂直居中
    For i As Integer = tbl.TopRow To tbl.BottomRow
    Rows = Tables("卷宗封面").Rows(i).DataRow.GetChildRows("卷内目录")
   
        For r As Integer = 0 To Rows.Count - 1
            rt.Cells(r+2,0).Text = rows(r)("序号")
            rt.Cells(r+2,1).Text = rows(r)("来源")
            rt.Cells(r+2,2).Text = rows(r)("责任人")
            rt.Cells(r+2,3).Text = rows(r)("材料编号_字号")
            rt.Cells(r+2,4).Text = rows(r)("材料编号_文号")
            rt.Cells(r+2,5).Text = rows(r)("标题")
            rt.Cells(r+2,6).Text = rows(r)("起始页")
            rt.Cells(r+2,7).Text = rows(r)("结束页")
            rt.Cells(r+2,8).Text = rows(r)("备注")
            
        Next
    \'End With
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() \'预览报表

--  作者:有点甜
--  发布时间:2014/8/3 10:19:00
--  

请可否自己学习一下,不要全部依赖别人

 

http://www.foxtable.com/help/topics/2241.htm