以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 专业报表如何实现关联表连续打印? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=187223) |
|
-- 作者:lin98 -- 发布时间:2023/7/1 11:13:00 -- 专业报表如何实现关联表连续打印? 专业报表打印只一个关联表一个打印,没办法连接打印,专业报表如何实现关联表连续打印?如图 |
|
-- 作者:有点蓝 -- 发布时间:2023/7/1 11:20:00 -- 默认就是连续打印的。意思是一个类别打一张纸? |
|
-- 作者:lin98 -- 发布时间:2023/7/1 11:52:00 --
|
|
-- 作者:lin98 -- 发布时间:2023/7/1 12:48:00 -- 上例实例,请老师帮处理,谢谢 [此贴子已经被作者于2023/7/1 13:59:48编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/7/1 13:26:00 -- 参考:http://www.foxtable.com/webhelp/topics/1250.htm |
|
-- 作者:lin98 -- 发布时间:2023/7/1 14:44:00 -- Dim doc As New PrintDoc \' Dim rt As prt.RenderTable\' Dim tb As Table = Tables("销售明细") Dim tbl As Table = Tables("销售主表") \' Dim Rows As List(Of DataRow)\' For i As Integer = tbl.TopRow To tbl.BottomRow \' doc.PageSetting.Width = 241 \' doc.PageSetting.Height = 113 \' doc.AutoRotate = False \' doc.PageSetting.TopMargin = 5 doc.PageSetting.BottomMargin = 5 doc.PageSetting.LeftMargin = 5 doc.PageSetting.RightMargin = 5 rt = New prt.RenderTable \' rt.BreakBefore = prt.BreakEnum.Page \' rt.Style.GridLines.All = New prt.Linedef \' rt.CellStyle.Spacing.All = 2 \' rt.Cells(0, 0).text = "销售出库单" \' rt.Cells(0, 0).SpanCols = 6 \' rt.Cells(0, 0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \' rt.Cells(0, 0).Style.Font = New Font("宋体", 12, FontStyle.Bold) \' rt.Cells(2, 0).text = "客户名称:" & tbl.Current("公司名称") \' rt.Cells(2, 0).Spancols = 2 \' rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white) \' rt.Rows(2).Style.Borders.All = New prt.LineDef("0mm", Color.white)\' rt.Rows(2).Style.Borders.Bottom = New prt.Linedef \' rt.Rows(2).Height = 8 \' rt.RowGroups(0, 1).Style.TextAlignVert = prt.AlignVertEnum.Center \' rt.RowGroups(0, 4).Header = prt.TableHeaderEnum.All \' rt.RowGroups(5, 1).DataBinding.DataSource = BindTables("销售明细") \' Dim ColNames As String() = New String(){"产品", "雇员", "单价" , "折扣", "数量" , "金额" } For c As Integer = 0 To Colnames.Length - 1 rt.Cells(4, c).Text = ColNames(c) rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth rt.Cells(5, c).Text = "[Fields!" & ColNames(c) & ".Value]" \' Next doc.Body.Children.Add(rt) Next Doc.Preview 上面代码执行后,只是连续打印主表的第一行的数据,没有按选中的数据进行打印,如何按选中的连续打印?
|
|
-- 作者:lin98 -- 发布时间:2023/7/1 14:58:00 -- 补一下,销售主表和销售明细是模拟关联, 不下面 1、在产品表和订单表之间建立关联,关联名为"po",注意关联表生成模式要选择为“无”: [此贴子已经被作者于2023/7/1 15:01:29编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/7/1 16:15:00 -- 按照帮助的用法,改为逐行赋值,不能使用绑定。 不做关联的话,改改获取子表的代码即可,比如 Rows = Tables("类别").Rows(i).DataRow.GetChildRows("产品") 改为 Rows = DataTables("产品").select("类别ID=\'" & Tables("类别").Rows(i)("类别ID") & "\'") 简单的处理逻辑就是 For i as Integer = tbl.TopRow To tbl.BottomRow 处理主表表头和子表标题 Rows = DataTables("销售明细").select("客户=\'" & Tables("销售主表").Rows(i)("公司名称") & "\'") For r As integer = 0 To Rows.Count - 1处理子表明细 ……
|
|
-- 作者:lin98 -- 发布时间:2023/7/1 17:02:00 -- 老师,我没改好,出乱,请帮处理,谢谢 [此贴子已经被作者于2023/7/1 17:26:35编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2023/7/1 17:12:00 -- 直接复制帮助代码,改改表名和列名就可以了 Dim doc As New Printdoc Dim rx As prt.RenderText Dim rt As prt.RenderTable Dim Rows As List(Of DataRow) Dim tbl As Table = Tables("销售主表") For i As Integer = tbl.TopRow To tbl.BottomRow rx = New prt.RenderText \' rx.BreakBefore = prt.BreakEnum.Page \'另起一页再打印 rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 5 rx.Text = "公司名称: " & Tables("销售主表").Rows(i)("公司名称") doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.Borders.Bottom = New prt.LineDef(0.3, Color.LightGray) rt.CellStyle.Spacing.All = 1 rt.Cols.Count = 4 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.rows(0).Style.Borders.Top = New prt.LineDef(1, Color.LightGray) rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1, Color.LightGray) Rows = DataTables("销售明细").select("客户=\'" & Tables("销售主表").Rows(i)("公司名称") & "\'") For r As Integer = 0 To Rows.Count - 1 rt.Cells(r + 1, 0).Text = rows(r)("产品") rt.Cells(r + 1, 1).Text = 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, 4).Text = rows(r)("数量") Next doc.Body.Children.Add(rt) rx = New prt.RenderText rx.Style.FontBold = True rx.Style.Spacing.Top = 3 rx.Text = "销售明细数目: " & Rows.Count rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right doc.Body.Children.Add(rx) Next doc.Preview |