ActiveReports 条件格式 - 图片可见性
在 ActiveReports 中,如何根据报表数据中的值更改格式?
具体来说,我想根据数据中的值显示或隐藏图片。报表通过其 DataSource 属性的集合绑定到对象列表。这些对象有一个 Condition
属性,其值为“Poor”、“Normal”等。我在报告中有一些对应于不同条件的图片,并且我想隐藏除与值对应的一个。
我应该订阅详细信息部分的 Format
事件吗?如果是这样,我如何获取“当前记录”数据?
In ActiveReports, how can I change formatting based on values in the report data?
Specifically, I want to show or hide pictures based on a value in the data. The report gets bound to a list of objects via a set to its DataSource property. These objects have a Condition
property with values "Poor", "Normal", etc. I have some pictures in the report that correspond to the different conditions, and I want to hide all the pictures except for the one corresponding to the value.
Should I subscribe to the Format
event for the detail section? If so, how do I get to the "current record" data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我仍然不知道如何获取当前数据对象,但我发现您可以使用报表的Fields
属性来检索当前数据对象的值。下面的代码订阅详细信息部分的Format
事件。Fields["Condition"].Value
获取当前数据对象的Condition
属性的值(恰好是一个枚举值)。< /s>编辑:
我已经了解到从 Format 事件访问 Fields 集合违反了 ActiveReports 设计规则,因为它在某些奇怪的角落不起作用案例。我现在改用这种方法: http://www.datadynamics.com /forums/ShowPost.aspx?PostID=133642#133642
DataDynamics 有一个功能请求 22786,要求提供对 Format 事件中的数据对象的访问。
Ok, I still don't know how to get the current data object, but I discovered that you can use the report'sFields
property to retrieve values off the current data object.The code below subscribes to the detail section'sFormat
event.Fields["Condition"].Value
gets the value of the current data object'sCondition
property (which happens to be an enum value).Edit:
I've since learned that accessing the Fields collection from a Format event is against the ActiveReports design rules, because it doesn't work in certain weird corner cases. I now use this method instead: http://www.datadynamics.com/forums/ShowPost.aspx?PostID=133642#133642
DataDynamics has a feature request 22786 to provide access to the data objects from Format events.