RDLC分组序号

来源:互联网 发布:ubuntu ssh 长连接 编辑:程序博客网 时间:2024/06/05 11:58

1、RDLC报表表格中添加序号,调用表达式RowNumber( Nothing )

2、RDLC报表,表格分组后添加序号,分两种情况

第一种情况,在分组内添加从1开始的序号,每个分组内都是从1开始计数。

在报表属性-》代码中添加如下代码:

Dim count As Integer
Dim GroupName As String
Public Function GroupCount(name As String) As String

If (GroupName = "") Then
count = 1
GroupName = name
GroupCount = count
Exit Function
End If

If (GroupName = name) Then
count = count + 1
GroupCount = count
Else
count = 1
GroupName = name
GroupCount = count
Exit Function
End If

End Function

然后在需要添加序号的表格中添加表达式=Code.GroupCount(Fields!bm.Value)


第二种情况,分组外排序,即给组排序,从1开始,每多一个不同的分组添加1,有多少个不同的组,序号就增加到多少。

Dim count As Integer
Dim GroupName As String
Public Function GroupCount(name As String) As String

If (GroupName = "") Then
count = 1
GroupName = name
GroupCount = count
Exit Function
End If

If (GroupName = name) Then
count = count
GroupCount = count
Else
GroupName = name
count = count + 1
GroupCount = count
End If

End Function

然后在需要添加序号的表格中添加表达式=Code.GroupCount(Fields!bm.Value)


其中方法一,在翻页的时候会重新从1开始计数,目前尚未解决,可以尝试将表格嵌套在矩阵中。

0 0
原创粉丝点击