以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 专业报表汇总模式强制换页搞不定 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=158717) |
-- 作者:石四 -- 发布时间:2020/11/30 13:51:00 -- 专业报表汇总模式强制换页搞不定 Dim doc As New PrintDoc Dim rx As New prt.RenderText rx.Text = "对账明细" rx.Style.Font = New Font("宋体", 16, FontStyle.Bold) rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center rx.Style.Spacing.Bottom = 6 Doc.body.Children.Add(rx) Dim rt As New Prt.RenderTable Dim cnt As Integer Dim tbl As Table = Tables("订单") Dim drs As List(Of DataRow) Dim pds As List(Of String) = tbl.DataTable.GetValues("产品",tbl.Filter) rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font For c As Integer = 0 To tbl.Cols.Count - 1 \'生成列标题 rt.Cells(0,c).Text = tbl.Cols(c).Name rt.Cols(c).Width = tbl.Cols(c).PrintWidth Next Dim ii As Integer = 2 \'第一页产品数 tbl.Filter = "[日期] >= #1/1/1999# And [日期] <= #2/28/1999#" For Each pd As String In pds \'分产品打印 If pd =pds(ii) Then MessageBox.show(pd) \' rt.BreakAfter = prt.BreakEnum.Page \'换页 Exit For End If If tbl.Filter > "" Then drs = tbl.DataTable.Select("产品 = \'" & pd & "\' And " & tbl.Filter) Else drs = tbl.DataTable.Select("产品 = \'" & pd & "\'" ) End If For Each dr As DataRow In drs \'逐行打印此产品的订单 cnt = rt.Rows.Count For c As Integer = 0 To tbl.Cols.Count - 1 rt.Cells(cnt, c).Text = dr(tbl.Cols(c).Name) Next Next cnt = rt.Rows.Count rt.Cells(cnt, 0).Text = "小计 " & pd \'打印产品的小计 rt.Cells(cnt,5).Text = tbl.compute("Sum(数量)", "产品 = \'" & pd & "\'") Next cnt = rt.Rows.Count rt.Cells(cnt, 0).Text = "合计 " \'打印合计 rt.Cells(cnt, 5).Text = tbl.compute("Sum(数量)") doc.Body.Children.Add(rt) doc.preview() ----------------- If pd =pds(ii) Then MessageBox.show(pd) \' rt.BreakAfter = prt.BreakEnum.Page \'换页 Exit For End If 这样断开第一面,第二页不知道怎么才能接上。 |
-- 作者:石四 -- 发布时间:2020/11/30 13:54:00 -- 余下的产品PD03,PD04,PD05 需要手动安排在第二页打印,以避免同一产品跨页断开 |
-- 作者:有点蓝 -- 发布时间:2020/11/30 14:24:00 -- Dim doc As New PrintDoc Dim rx As New prt.RenderText rx.Text = "对账明细" rx.Style.Font = New Font("宋体", 16, FontStyle.Bold) rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center rx.Style.Spacing.Bottom = 6 Doc.body.Children.Add(rx) Dim rt As New Prt.RenderTable Dim cnt As Integer Dim tbl As Table = Tables("订单") Dim drs As List(Of DataRow) Dim pds As List(Of String) = tbl.DataTable.GetValues("产品",tbl.Filter) rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font For c As Integer = 0 To tbl.Cols.Count - 1 \'生成列标题 rt.Cells(0,c).Text = tbl.Cols(c).Name rt.Cols(c).Width = tbl.Cols(c).PrintWidth Next Dim ii As Integer = 2 \'第一页产品数 tbl.Filter = "[日期] >= #1/1/1999# And [日期] <= #2/28/1999#" For Each pd As String In pds \'分产品打印 If pd =pds(ii) Then rt.BreakAfter = prt.BreakEnum.Page \'换页 doc.Body.Children.Add(rt) rt = New Prt.RenderTable rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font For c As Integer = 0 To tbl.Cols.Count - 1 \'生成列标题 rt.Cells(0,c).Text = tbl.Cols(c).Name rt.Cols(c).Width = tbl.Cols(c).PrintWidth Next cnt = 0 \'MessageBox.show(pd) \' Exit For End If If tbl.Filter > "" Then drs = tbl.DataTable.Select("产品 = \'" & pd & "\' And " & tbl.Filter) Else drs = tbl.DataTable.Select("产品 = \'" & pd & "\'" ) End If For Each dr As DataRow In drs \'逐行打印此产品的订单 cnt = rt.Rows.Count For c As Integer = 0 To tbl.Cols.Count - 1 rt.Cells(cnt, c).Text = dr(tbl.Cols(c).Name) Next Next cnt = rt.Rows.Count rt.Cells(cnt, 0).Text = "小计 " & pd \'打印产品的小计 rt.Cells(cnt,5).Text = tbl.compute("Sum(数量)", "产品 = \'" & pd & "\'") Next cnt = rt.Rows.Count rt.Cells(cnt, 0).Text = "合计 " \'打印合计 rt.Cells(cnt, 5).Text = tbl.compute("Sum(数量)") doc.Body.Children.Add(rt) doc.preview()
|
-- 作者:石四 -- 发布时间:2020/11/30 14:37:00 -- 蓝版手到擒来,谢了。 |