Crystal Report以编程方式排序 [英] Crystal Report programaticly Sort

查看:78
本文介绍了Crystal Report以编程方式排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道怎样才能进行编程排序,我发现下面的例子

来自bellow链接: http://social.msdn.microsoft.com / forums / zh-CN / csharpgeneral / thread / 49ed286b-5aea-4414-b58a-9f10601eb076 [ ^ ]

Hi,

I want to know how can I make a programaticly sort, I found the bellow example
from the bellow link: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/49ed286b-5aea-4414-b58a-9f10601eb076[^]

SortFields sortFields = m_Report.DataDefinition.SortFields;
sortFields[0].Field = m_Report.Database.Tables[table].Fields[field];
sortFields[0].SortDirection = CrystalDecisions.Shared.SortDirection.AscendingOrder;





我有三个排序参数的问题,(Sub_id,Gen​​der和JobCateg),这个例子不能用它,



在此先感谢

Otto



The problem that I have three sort parameter,(Sub_id,Gender and JobCateg), that example don't work with it,

Thanks in Advance
Otto

推荐答案

OP写道:

我发现了吼叫示例

来自下面的链接:http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/49ed286b-5aea-4414-b58a-9f10601eb076 [^]

I found the bellow example
from the bellow link: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/49ed286b-5aea-4414-b58a-9f10601eb076[^]



可悲的是,这不是一个解决方案的链接,也有OP问你的问题。

别担心我会给你解决方案。



你去吧

C#:将多个SortField添加到CrystalReportViewer使用反射 [ ^ ]




Sadly it's not a solution link, there also the OP asked the question like you.
Don't worry I'll give you solution.

Here you go
C#: Adding many SortField to a CrystalReportViewer using reflection[^]

OP写道:

提前谢谢

Otto



关闭主题,最近我看了电影北极圈爱好者 [ ^ ],其中,前导字符名称 Otto 是回文:)


Off Topic, Recently I saw the movie Lovers of the Arctic Circle[^], In that, the leading character name also Otto which is palindrome :)


非常感谢f或者你的回答,我会尝试,然后尽快回复你。



奥托:)
thanks a lot for your answer, i will try it, and back to you asap.

Otto :)


Hello, It is working fine

Dim fieldDef As DatabaseFieldDefinition = ReportDoc.Database.Tables(crTable.Name).Fields(crField.Name)
getRasSorts = targetSortField.[GetType]().GetMethod("get_RasSorts", BindingFlags.NonPublic Or BindingFlags.Instance)
rasSorts = getRasSorts.Invoke(targetSortField, System.Type.EmptyTypes)
addSort = rasSorts.[GetType]().GetMethod("Add")
rasAssembly = getRasSorts.ReturnType.Assembly
ciRasSort = rasAssembly.[GetType]("CrystalDecisions.ReportAppServer.DataDefModel.SortClass").GetConstructor(BindingFlags.[Public] Or BindingFlags.Instance, Nothing, System.Type.EmptyTypes, Nothing)
rasSort = ciRasSort.Invoke(System.Type.EmptyTypes)
setSortField = rasSort.[GetType]().GetMethod("set_SortField", BindingFlags.[Public] Or BindingFlags.Instance)
Dim getRasField As MethodInfo = fieldDef.[GetType]().GetMethod("get_RasField", BindingFlags.NonPublic Or BindingFlags.Instance)
Dim rasField As Object = getRasField.Invoke(fieldDef, System.Type.EmptyTypes)
addSort.Invoke(rasSorts, New Object() {rasSort})
setSortField.Invoke(rasSorts, New Object() {rasField})
Dim n As Integer = ReportDoc.DataDefinition.SortFields.Count - 1
targetSortField(n).Field = fieldDef
targetSortField(n).SortDirection = CrystalDecisions.[Shared].SortDirection.AscendingOrder


这篇关于Crystal Report以编程方式排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆