以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表怎么让绑定的数字字段按千分位显示?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74003)

--  作者:大红袍
--  发布时间:2015/8/31 11:30:00
--  

Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim tb As Table = Tables("订单")
Dim ColNames As String() = New String(){"产品", "客户","单价", "数量", "金额"}
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
    If ColNames(c) = "金额" OrElse ColNames(c) = "数量" Then
        rt.Cells(1, c).Text = "[format(Fields!" & ColNames(c) & ".Value, ""#,###"")]" \'设置绑定表达式
    Else
        rt.Cells(1, c).Text ="[Fields!"&ColNames(c)&".Value]"
    End If
Next
rt.RowGroups(0,1).Style.TextAlignVert = prt.AlignVertEnum.Center \'第一行内容垂直居中
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'将第一行作为表头.
rt.RowGroups(1,1).DataBinding.DataSource = BindTables("订单") \'将第二行绑定到订单表
doc.Body.Children.Add(rt)
doc.Preview()