以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]专业报表如何绑定关联表的子表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121334) |
-- 作者:5159518 -- 发布时间:2018/7/4 10:38:00 -- [求助]专业报表如何绑定关联表的子表 老师,请问专业报表如何绑定关联表,代码如何写? Dim rb1 As New prt.RenderTable() \'定义一个表格对象 With rb1 \'.DataBinding.DataSource = BindTables("B02订单报价.B02订单管理") \'将rt绑定到订单表 .x = 10 .y = "Prev.Bottom + 10" .Style.GridLines.All = New Prt.LineDef (0.4, Color.Black) .Style.GridLines.Left = New Prt.LineDef (0,Color.Transparent) .Style.GridLines.Right = New Prt.LineDef (0,Color.Transparent) .Style.GridLines.Horz = new Prt.LineDef(0.1,Color.Black) .Style.GridLines.Vert = new Prt.LineDef(0.1,Color.Black) .Cols.Count = 6 \'设置列数 .Cols(0).Width = 40 \'设置列宽 .Cols(1).Width = 50 \'设置列宽 .Cols(2).Width = 50 \'设置列宽 .Cols(3).Width = 10 \'设置列宽 .Cols(4).Width = 20 \'设置列宽 .Style.Font = f11 \'字体设置 .Style.TextAlignHorz = prt.AlignHorzEnum.Center \'所有文本内容中间对齐 .Style.TextAlignVert = prt.AlignVertEnum.Bottom \'所有文本内容下部对齐 Dim st As String() = {"品名" & Chr(13) & "Description","规格" & Chr(13) & "Specification","序列号" & Chr(13) & "Series Number","单位" & Chr(13) & "Unit","价格" & Chr(13) & "Price","备注" & Chr(13) & "Remark"} For i As Integer = 0 To 5 Dim rx As New prt.RenderText rx.text = st(i) .Cells(0, i).RenderObject = rx Next .Rows.Count = 9 \'设置行数 .Rows(0).Height = 9 For i As Integer = 1 To 8 .Rows(i).Height = 6 \'设置行高 Tables("B02订单报价.B02订单管理").Position = i - 1 For x As Integer = 0 To 5 Dim rx As New prt.RenderText Select Case i Case 0 rx .text = "[Fields!开票项目名称.Value]" .Cells(0, 0).RenderObject = rx Case 1 rx .text = "[Fields!规格型号.Value]" .Cells(0, 0).RenderObject = rx Case 2 rx .text = "[Fields!SN编码.Value]" .Cells(0, 0).RenderObject = rx Case 3 rx .text = "[Fields!单位.Value]" .Cells(0, 0).RenderObject = rx Case 4 rx .text = "[Fields!单价.Value]" .Cells(0, 0).RenderObject = rx Case 5 rx .text = "[Fields!备注.Value]" .Cells(0, 0).RenderObject = rx End Select Next Next doc.Body.Children.Add(rb1) \'将表格对象加入到报表中 以上代码是专业报表代码中的一部分,现在“ \'.DataBinding.DataSource = BindTables("B02订单报价.B02订单管理") \'将rt绑定到订单表” 这句代码如果不注释掉就连表标题都显示不出来,所以应该是这句代码出错了,但是不知道如何写?在帮助文件中也没有找到相关的教程,word报表中可以绑定子表数据的,我想专业报表中肯定也好绑定吧?只是我还没有找到方法,不要建议我用word报表,用word报表虽然简单,但是运行的时候老是出错,应该是和word的兼容性问题吧,而且我已经花了好多功夫将专业报表做好了,就剩下这个子表的数据绑定了
|
-- 作者:有点甜 -- 发布时间:2018/7/4 11:22:00 -- 不能用绑定的方法,参考
http://www.foxtable.com/webhelp/scr/1249.htm
|
-- 作者:5159518 -- 发布时间:2018/7/4 11:56:00 -- 谢谢老师,我再试试看 |