How to create a custom toolbar for web FastReport.Net report
Many users of report generators are interested in setting up the toolbar when reviewing the report. Such questions appear periodically on forums and questionnaires. Like this user of the DevExpress report generator who wants to customize the web report toolbar ASP.Net MVC.
In some cases, the user will simply be satisfied with hiding unnecessary controls. But what if the standard report review toolbar doesn't satisfy at all?
A standard web report toolbar may not suit the user by design or toolkit. The only solution to these problems may be to implement your own toolbar. Of course, it does not have to be a panel, controls can be placed as you like on the web page. We're just going to "pull the report for the right ropes" to get the behaviour we need. As an example, we'll look at the standard ASP.Net MVC app.
Web method returns a representation of the report and by custom controls. We use a static object of the web report, in order to be able to manipulate them throughout the application. For example, turning the pages.
The web method takes several parameters: export type, display toolbar, panel style, type of transition to another page.
This method essentially selects the action depending on which button we click on the web page. In addition to the actions of navigating the report, there is a button to print the report.
These and other report navigation methods use the standard function buttons on the report toolbar.
The report print can also be set as PrintPDF(). At the same time, the report will be pre-exported to the pdf format.
In order to determine the export format, we again used a switch statement. Depending on the selected format is performed corresponding to the export method.
Now let's take a look at the program. As you know, our task is to create a print, export and navigation report control.
We have added a Print button, a drop-out list with export types, a checkbox hiding a standard toolbar, and a page-by-page transition button (first, previous, next, and last page). Let's see what happened:
As a result, we created our own toolbar to interact with the report. That will allow us to embed these elements into the design of the web page and abandon the standard panel. In this example, we didn't implement all the functionality of a standard toolbar, but only basic features. You can easily implement other features by analogy with the example considered.