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编辑过]