logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Customer panel Support
    • en
    • pt
    • es
    • de
    • pl
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • How to remove unnecessary objects from the preview window toolbar
  • PreviewControl.OnPrint and PreviewControl.OnExport Events

    October 1, 2020

    In FastReport 2019.4 added the ability to subscribe to PreviewControl.OnPrint and PreviewControl.OnExport events, which are

    read more
  • How to create a custom toolbar for web FastReport.NET report

    May 31, 2020

    Many users of report generators are interested in setting up the toolbar when reviewing the

    read more
  • How to disable printing reports and other items from the menu when viewing the report FastReport .NET

    February 29, 2020

    The main report viewing tool FastReport.Net is Viewer. This viewer has a rich toolkit for

    read more
  • How to hide unnecessary items from the Web Report toolbar

    June 3, 2020

    Most advanced report generators let us generate reports for web applications. When displaying reports to

    read more
  • Toolbar customization and export settings in FastReport.Web for Core

    September 6, 2021

    Our users often need to change the appearance of the toolbar or customize the export

    read more

How to remove unnecessary objects from the preview window toolbar

May 19, 2018

Sometimes you may need to limit the functionality of the report, for example, remove unnecessary export formats from the list in the preview mode. This can be done in your application code. Let’s write a function to delete a report object:  

1
2
3
4
5
 private void RemoveRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 RegisteredObjects.Objects.Items.Remove(obj);
 }

 As you can see, first you need to find the specified object in the collection of registered objects. Then delete the object.

Now let's see how to call this method:      

1
2
3
4
 RemoveRegistered(typeof(FastReport.Export.LaTeX.LaTeXExport));
 RemoveRegistered(typeof(FastReport.Export.Zpl.ZplExport));
 RemoveRegistered(typeof(FastReport.Export.Svg.SVGExport));
 RemoveRegistered(typeof(FastReport.Export.Dbf.DBFExport));

 That is, to remove the registered object, you just need to pass the object type.

Important note! You must delete objects after creating the Report object, otherwise, when you delete, you will search for objects in an empty collection.

Another way to disable objects is also possible:

1
2
3
4
5
 private void DisableRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 obj.Enabled = false;
 }

 In this case, you can both turn off and include objects by writing one more function:

1
2
3
4
5
 private void EnableRegistered(Type type)
 {
 ObjectInfo obj = RegisteredObjects.FindObject(type);
 obj.Enabled = true;
 }

 In this way, you can organize the management of the display of objects in the report preview menu.

We considered deletion of objects using the example of exports, but this is also true for all other registered objects (functions, transports, etc.).

about product download buy
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET FastReport Preview Toolbar

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Contact us

© 1998-2022 by Fast Reports Inc.

  • Privacy Policy