以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于专业报表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93956) |
-- 作者:czy66ds -- 发布时间:2016/12/12 9:35:00 -- 关于专业报表 专业报表的实战演练中有一节“分页汇总”, 我想在每页打印的表格上方添加打印文本“AAAAAAAA”, 并在在每页打印的表格下方添加打印文本“BBBBBBBB”,
该如何添加代码? |
-- 作者:有点色 -- 发布时间:2016/12/12 10:03:00 -- 参考
http://www.foxtable.com/webhelp/scr/1197.htm
http://www.foxtable.com/webhelp/scr/1221.htm
[此贴子已经被作者于2016/12/12 10:03:32编辑过]
|
-- 作者:有点蓝 -- 发布时间:2016/12/12 10:03:00 -- 参考:http://www.foxtable.com/webhelp/scr/2735.htm |
-- 作者:czy66ds -- 发布时间:2016/12/12 10:23:00 -- 谢谢,但是我不想按表头、表尾处理,我要加入的打印内容是希望上下紧贴表格,改如何处理? |
-- 作者:逛逛 -- 发布时间:2016/12/12 10:30:00 -- 载套一个表格啊 |
-- 作者:有点色 -- 发布时间:2016/12/12 10:32:00 -- 以下是引用czy66ds在2016/12/12 10:23:00的发言:
谢谢,但是我不想按表头、表尾处理,我要加入的打印内容是希望上下紧贴表格,改如何处理?
写在循环的头部和尾部。 |
-- 作者:czy66ds -- 发布时间:2016/12/13 11:32:00 -- 进一步具体询问:在狐表CaseStudy提供的专业报表项目中,在命令窗口运行帮助中专业报表实战演练的分页汇总代码(我加上了红色和蓝色两部分): Dim doc As New PrintDoc Dim tb As Table = Tables("订单") Dim prs As Integer = 20 \'每页20行 Dim sum1 As Integer = 0 \'数量小计 Dim sum2 As Double = 0 \'金额小计 Dim tsum1 As Integer = 0 \'数量总计 Dim tsum2 As Double = 0 \'金额总计 Dim idx1 As Integer= tb.cols("数量").Index Dim idx2 As Integer= tb.cols("金额").Index \'Dim rx As prt.RenderText For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1 Dim rx As new prt.RenderText rx.Text= "AAAAAAAAAAAAAAAAAAA" doc.Body.Children.Add(rX) Dim rt As New prt.RenderTable rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) rt.CellStyle.Spacing.All = 0.5 sum1 = 0 sum2 = 0 For c As Integer = 0 To tb.Cols.Count - 1 rt.Cells(0,c).Text = tb.Cols(c).Name Next For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1) sum1 =sum1 + tb.rows(r)("数量") sum2 =sum2 + tb.rows(r)("金额") For c As Integer = 0 To tb.Cols.Count - 1 rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c) Next Next Dim rx1 As new prt.RenderText rx1.TEXT = "BBBBBBBBBBBBBBBBBBB" doc.Body.Children.Add(rX1) tsum1 = tsum1 + sum1 tsum2 = tsum2 + sum2 rt.Rows.Count = rt.Rows.Count + 1 \'增加本页小计行 rt.Rows(rt.Rows.count -1)(0).text = "本页小计" rt.Rows(rt.Rows.count -1)(idx1).text = sum1 rt.Rows(rt.Rows.count -1)(idx2).text = sum2 If p = math.Ceiling(tb.Rows.Count / prs) - 1 \'如果是最后一页 rt.Rows.Count = rt.Rows.Count + 1 \'增加总计行 rt.Rows(rt.Rows.count -1)(0).text = "总计" rt.Rows(rt.Rows.count -1)(3).text = tsum1 rt.Rows(rt.Rows.count -1)(6).text = tsum2 Else rt.BreakAfter = prt.BreakEnum.Page \'否则换页 End If doc.Body.Children.Add(rt) Next doc.Preview() 运行结果为: 结果“AAAAAAAA”和“BBBBBBB”都在表格的上方。 我希望文字"BBBBBBBBBBB"出现在表格的下边,那么蓝色的代码段该写在哪里? |
-- 作者:有点蓝 -- 发布时间:2016/12/13 12:00:00 -- 看3楼,没有其它办法,你这个代码放哪里都实现不了 |
-- 作者:blackzhu -- 发布时间:2016/12/13 12:43:00 -- 代码改个方式吧,不然很难实现,不然你这样: Dim rx As new prt.RenderText rx.Text= "AAAAAAAAAAAAAAAAAAA bbbbbbbbbbb" doc.Body.Children.Add(rX) 加无数空格凑 |
-- 作者:有点蓝 -- 发布时间:2016/12/13 13:51:00 -- Dim doc As New PrintDoc Dim tb As Table = Tables("订单") Dim prs As Integer = 20 \'每页20行 Dim sum1 As Integer = 0 \'数量小计 Dim sum2 As Double = 0 \'金额小计 Dim tsum1 As Integer = 0 \'数量总计 Dim tsum2 As Double = 0 \'金额总计 Dim idx1 As Integer= tb.cols("数量").Index Dim idx2 As Integer= tb.cols("金额").Index \'Dim rx As prt.RenderText For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1 Dim rx As new prt.RenderText rx.Text= "AAAAAAAAAAAAAAAAAAA" doc.Body.Children.Add(rX) Dim rt As New prt.RenderTable rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) rt.CellStyle.Spacing.All = 0.5 sum1 = 0 sum2 = 0 For c As Integer = 0 To tb.Cols.Count - 1 rt.Cells(0,c).Text = tb.Cols(c).Name Next For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1) sum1 =sum1 + tb.rows(r)("数量") sum2 =sum2 + tb.rows(r)("金额") For c As Integer = 0 To tb.Cols.Count - 1 rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c) Next Next tsum1 = tsum1 + sum1 tsum2 = tsum2 + sum2 rt.Rows.Count = rt.Rows.Count + 1 \'增加本页小计行 rt.Rows(rt.Rows.count -1)(0).text = "本页小计" rt.Rows(rt.Rows.count -1)(idx1).text = sum1 rt.Rows(rt.Rows.count -1)(idx2).text = sum2 If p = math.Ceiling(tb.Rows.Count / prs) - 1 \'如果是最后一页 rt.Rows.Count = rt.Rows.Count + 1 \'增加总计行 rt.Rows(rt.Rows.count -1)(0).text = "总计" rt.Rows(rt.Rows.count -1)(3).text = tsum1 rt.Rows(rt.Rows.count -1)(6).text = tsum2 Else rt.BreakAfter = prt.BreakEnum.Page \'否则换页 End If rt.Rows.Count = rt.Rows.Count + 1 Dim ro = rt.Rows(rt.Rows.count -1) ro(0).text = "BBBBBBBBBBBBBBBBBBB" ro(0).SpanCols = 8 ro.Height = 8 ro.Style.TextAlignVert = prt.AlignVertEnum.Center ro.Style.Borders.All = New prt.LineDef("0mm", Color.white) ro.Style.Borders.Top = New prt.Linedef(Color.Gray) doc.Body.Children.Add(rt) Next doc.Preview()
|