FastReport中国社区FastReport联系电话 联系电话:023-68661681

如何在FastReport中从预览模式中删除不必要的对象

来源:   发布时间:2018-07-13   浏览:2679次

下载FastReport最新版本

当用户需要限制报表的功能,例如:在预览模式下从列表中删除无用的导出格式,这可以应用程序的代码中完成。编写删除报表对象的命令如下: No.1:需要在已注册对象的集合中查找指定的对象,然后删除该对象。
 private void RemoveRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 RegisteredObjects.Objects.Items.Remove(obj);
 }
No.2:调用此方法,要删除已注册的对象,只需传递对象类型即可。PS:必须在创建Report对象后删除对象,否则在删除后,将在空集合中搜索对象。
RemoveRegistered(typeof(FastReport.Export.LaTeX.LaTeXExport));
RemoveRegistered(typeof(FastReport.Export.Zpl.ZplExport));
RemoveRegistered(typeof(FastReport.Export.Svg.SVGExport));
RemoveRegistered(typeof(FastReport.Export.Dbf.DBFExport));
另一种禁用对象的方法
 private void DisableRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 obj.Enabled = false;
 }
No3:写一个函数来排除包含对象
private void EnableRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 obj.Enabled = true;
 }
通过这种方式,可以在报表预览菜单中管理对象显示。
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:FastReport控件中文网 [https://www.fastreportcn.com/]
本文地址:https://www.fastreportcn.com/post/2115.html

联系我们
  • 重庆总部 023-68661681
购买
  • sales@evget.com
合作
  • business@evget.com


在线
客服
微信
QQ 电话
023-68661681
返回
顶部