以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 专业报表设计 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=83124) |
-- 作者:kaituozhe -- 发布时间:2016/3/31 22:44:00 -- 专业报表设计 以下黄色代码怎么修改呀?以下代码分三种情况写标签,一是只有一个子项则把相关信息直接写入标签中;二是无户名无账号的按交易内容分类并写入相应的标签中;三是明细较多则增加附表: Dim doc As New PrintDoc \'定义一个报表 doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置排列方式 Dim tb As Table =Tables("交易汇总") Dim tb1 As Table =Tables("交易明细") Dim lis As List (of String) = tb.DataTable.GetValues("户名","户名 is not null","[_sortkey]") Dim lis1 As List (of String) = tb1.DataTable.GetValues("交易内容","对方户名 = \'无户名无账号\'","[_sortkey]") Dim drs As List(Of DataRow) For i As Integer = 0 To lis.Count-1 Dim ra As New prt.RenderArea Dim rt As prt.RenderText ra.Width = 60 \'宽度53毫米 ra.Height = 15 \'高度24毫米 ra.Style.Spacing.All = 1 ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) \'设置边框 ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 Doc.Body.ChildRen.Add(ra) \'将容器加入到报表中 drs = tb.DataTable.DataRows(i).GetChildRows("交易明细") If drs.Count = 1 Then rt = New prt.RenderText rt.Text = drs(0)("交易日期") rt.X = 2 rt.Y = 2 ra.Children.Add(rt) rt = New prt.RenderText rt.Text = drs(0)("借方金额")/10000 & "万" rt.X = 30 rt.Y = "Prev.top" \'垂直坐标位于迁移对象之下的2毫米 ra.Children.Add(rt) rt = New prt.RenderText rt.Text = drs(0)("对方账号") rt.X = 2 rt.Y = "Prev.Bottom + 2" ra.Children.Add(rt) rt = New prt.RenderText rt.Text = drs(0)("对方户名") rt.X = 40 rt.Y = "Prev.Top" \'垂直坐标和前一对象相同 ra.Children.Add(rt) ElseIf lis(i) = "无户名无账号" Then For n As Integer = 0 To lis1.Count - 1 rt = New prt.RenderText rt.Text = lis1(n) rt.X = 2 rt.Y = 2 ra.Children.Add(rt) rt = New prt.RenderText rt.Text = tb1.DataTable.Compute("sum(借方金额)","交易内容 = \'" & lis1(n) & "\'")/10000 & "万" rt.X = 30 rt.Y = "Prev.top" \'垂直坐标位于迁移对象之下的2毫米 ra.Children.Add(rt) Next Else rt = New prt.RenderText rt.Text = tb(i)("户名") rt.X = 2 rt.Y = 2 ra.Children.Add(rt) rt = New prt.RenderText rt.Text = tb(i)("银行明细_借方金额")/10000 & "万" rt.X = 30 rt.Y = "Prev.top" \'垂直坐标位于迁移对象之下的2毫米 ra.Children.Add(rt) End If Next doc.PageSetting.Landscape = True Doc.Preview() \'预览报表
|
-- 作者:大红袍 -- 发布时间:2016/3/31 22:46:00 -- 没看懂你什么意思,上传例子说明。 |