Foxtable(狐表)用户栏目专家坐堂 → [求助]专业报表_汇总模式代码


  共有2104人关注过本帖平板打印复制链接

主题:[求助]专业报表_汇总模式代码

帅哥哟,离线,有人找我吗?
hanzhang98
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:493 积分:3637 威望:0 精华:0 注册:2018/6/8 21:14:00
[求助]专业报表_汇总模式代码  发帖心情 Post By:2019/8/24 16:55:00 [只看该作者]

老师好.  如何将如下 设置数值显示格式的代码 增加到帮助示例 关于"分组统计-- 汇总模式" 的代码中,  . 谢谢.

IF 统计数值 <> 0 Then        '黄底色部分不会写,请老师帮助指导
    rt.Rows(单元格).Text = Format(hqnj ,"#,##0.00") 
    rt.Rows(单元格).Style.Font = New Font("宋体", 8) 
    rt.Rows(单元格).Style.TextAlignHorz = prt.AlignHorzEnum.Center 
Else
    rt.Rows(单元格).Text = Format(hqnj ,"  -")
End If

以下是帮助示例中 关于"分组统计-- 汇总模式" 的代码:

Dim doc As New PrintDoc
Dim
rt As New prt.RenderTable
Dim
tb as Table = Tables("订单")
Dim
ColNames As String() = New String(){"产品", "客户","单价", "数量", "金额"}
rt
.Style.GridLines.All = New prt.Linedef(Color.Gray)
rt
.CellStyle.Spacing.All = 1
For
c As integer = 0 To ColNames.Length -1
rt
.Cells(0,c).Text = ColNames(c
)
rt
.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth

rt.Cells(1, c).Text = "
[Fields!" & ColNames(c) & ".Value]"
Next

rt.Cells(
2,0).Text ="[Fields!客户.Value]小计"
rt.Cells(
2,0).SpanCols = 3
rt.Cells(
2,3).Text = "[Aggregates!数量小计2.Value]"
rt.Cells(
2,4).Text = "[Aggregates!金额小计2.Value]"
rt.Cells(
3,0).Text ="[Fields!产品.Value]小计"
rt.Cells(
3,0).SpanCols = 3
rt.Cells(
3,3).Text = "[Aggregates!数量小计1.Value]"
rt.Cells(
3,4).Text = "[Aggregates!金额小计1.Value]"
rt.Cells(
4,0).Text ="总计"
rt.Cells(
4,0).SpanCols = 3
rt.Cells(
4,3).Text = "[Aggregates!数量总计.Value]"
rt.Cells(
4,4).Text = "[Aggregates!金额总计.Value]"
rt.Rows(
0).Style.TextAlignVert = prt.AlignVertEnum.Center
rt.RowGroups(
0,1).Header = prt.TableHeaderEnum.All
With
rt.RowGroups(1,3)
.DataBinding.DataSource = BindTables(
"订单")
.DataBinding.Grouping.Expressions.Add(
"Fields!产品.Value")
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"数量小计1", "Fields!数量.Value", .DataBinding, 1, 0))
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"金额小计1", "Fields!金额.Value", .DataBinding, 1, 0))
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"数量总计", "Fields!数量.Value", .DataBinding, 0, 0))
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"金额总计", "Fields!金额.Value", .DataBinding, 0, 0))
End
With
With
rt.RowGroups(1,2)
.DataBinding.DataSource = BindTables(
"订单")
.DataBinding.Grouping.Expressions.Add(
"Fields!客户.Value")
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"数量小计2", "Fields!数量.Value", .DataBinding, 1, 0))
doc.DataSchema.Aggregates.Add(New prt.DataBinding.Aggregate(
"金额小计2", "Fields!金额.Value", .DataBinding, 1, 0))
End
With
rt.RowGroups(
1,1).DataBinding.DataSource = BindTables("订单")
doc.Body.Children.Add(rt)
doc.Preview()



[此贴子已经被作者于2019/8/24 17:02:15编辑过]

 回到顶部
总数 11 1 2 下一页