Crystal Report的子报告抑制问题 [英] Crystal Report's Subreports Suppress Problem

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

问题描述

Hai all,



在C#中,如何以编程方式抑制Crystal Report的子报告..?



请帮助..

Hai all,

In C#, How can I Suppress Crystal Report's Subreport programmatically..?

Please help..

推荐答案

我知道我回答这个问题的方式已经很晚了,但是看看我是如何长时间努力寻找更合适的(在我看来)解决同样的问题,我想我会继续在这里分享。你可以直接访问子报告并直接压缩它们:



I know I'm way late to answer this question, but seeing as how I was searching long and hard for a more appropriate (in my opinion) solution to the same problem, I figured I'd go ahead and share it here. You can access the subreports directly and directly suppress them like this:

// Here, subreportName is the name of the object, not the name of the file
var subrpt = (SubreportObject)report.ReportDefinition.ReportObjects["subreportName"];

subrpt.ObjectFormat.EnableSuppress = true;





我更喜欢在可能的情况下直接操作对象模型...特别是因为它允许我避免搞乱Crystal中的脚本,这对我来说不是很直观



I far prefer to directly manipulate the object model where possible... especially because it allows me to avoid messing with scripts in Crystal, which are not very intuitive to me


你想要的使用公式将Suppress标志设置为以参数值为条件,然后从代码设置参数。



您必须在设计器中切换该标志(有条件地压制子报告)。然后你可以做这样的事情来设置参数:

You want to set the Suppress flag to be conditional on a parameter value using a formula, then set the param from code.

You'll have to toggle that flag in the designer (to conditionally suppress the subreport). You can then do something like this to set the param:
report.SetParameterValue("suppressSubReport", 1, "NameOfSubreport");





希望这会有所帮助。



干杯。



Hope this helps.

Cheers.


这篇关于Crystal Report的子报告抑制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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