Foxtable(狐表)用户栏目专家坐堂 → 专业报表分组问题 报错!


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

主题:专业报表分组问题 报错!

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


加好友 发短信
等级:九尾狐 帖子:2454 积分:22630 威望:0 精华:0 注册:2011/3/29 17:14:00
专业报表分组问题 报错!  发帖心情 Post By:2019/10/19 19:47:00 [只看该作者]


Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim ra As prt.RenderArea
Dim CurRow As Row = Tables("项目管理").Current


''插入关联子项
Relations.Add("关联1",DataTables("项目管理").DataCols("报价ID"),DataTables("项目选型表").DataCols("报价ID"))  '动态创建关联


ra.DataBinding.DataSource = BindTables("项目管理.项目选型表") '将容器绑定到订单表
ra.DataBinding.Grouping.Expressions.Add("Fields!产品分类.Value") '根据产品进行分组
ra.Style.Spacing.Bottom = 2

'这一个RenderText无需设置DataBinding,这样每一个分组只打印一次
rt.Text= "[Fields!产品分类.Value]明细:" 
rt.Style.FontSize = 14
rt.Style.FontBold = True
ra.Children.Add(rt)


关联表内容根据  产品分类  分组导出如何做?上面代码不能用

rt = New prt.RenderTable
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.GridLines.All = New prt.Linedef(Color.DeepSkyBlue) '设置网格线
rt.CellStyle.Spacing.All = 0.5


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,6).Text = "备注"

With Tables("项目管理.项目选型表")
    For r As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
        rt.Cells(r+1,0).Text = .rows(r)("产品名称")
        rt.Cells(r+1,1).Image = GetImage(.rows(r)("图片"))
        rt.Cells(r+1,2).Text = .rows(r)("主材工艺")
        rt.Cells(r+1,3).Text = .rows(r)("单价")
        rt.Cells(r+1,4).Text = .rows(r)("单位")
        rt.Cells(r+1,5).Text = .rows(r)("应用范围")
        rt.Cells(r+1,6).Text = .rows(r)("备注")
        
    Next
End With
ra.Children.Add(rt)
doc.body.Children.Add(ra)
Relations.Delete("关联1")

[此贴子已经被作者于2019/10/20 1:01:32编辑过]

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


加好友 发短信 一级勋章
等级:超级版主 帖子:7235 积分:40550 威望:0 精华:16 注册:2008/8/31 23:23:00
  发帖心情 Post By:2019/10/19 22:13:00 [只看该作者]

提问不描述问题吗?

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


加好友 发短信
等级:超级版主 帖子:105948 积分:538809 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/10/20 21:43:00 [只看该作者]

"项目选型表"有产品分类这个列吗?绑定只能使用绑定的表的列。

 回到顶部