Report Viewer is a component used to view final document. The following manipulations over the document are available: zoom, search, bookmark tree, various view parameters. It is possible to export, print and save reports to a file. To edit final document it is necessary to run Report Designer.

Using Report Viewer in Win Forms Applications

To use the Report Viewer in your applications you need to put the PerpetuumSoft.Reporting.View.ReportViewer component on the form.

Report Viewer is a separate component having a set of properties that allow setting its appearance. There properties can switch on\off visibility of the status bar, toolbar and separate buttons and groups of buttons on the toolbar. Below is the list of these properties.

 Property   Description  
 ShowContent   Show or not the “Show content” button and document table of contents 
 ShowDesigner   Show or not the “Edit report” button 
 ShowExport   Show or not the “Export document” button 
 ShowFind   Show or not the “Find text” button 
 ShowNavigator   Show or not the “Move backwards” and “Move forward” buttons 
 ShowOpen   Show or not the “Open document” 
 ShowPageNavigator   Show or not buttons: “Go to first page”, “Go to previous page”, “Go to next page”, “Go to last page” 
 ShowPrint   Show or not the “Print document” button 
 ShowRefresh   Show or not the “Refresh report” button 
 ShowSave   Show or not the “Save document” button 
 ShowScale   Show or not buttons: “Pan mode”, “Dynamic zoom mode”, “Zoom in mode”, “Zoom out mode”, “Zoom to rectangle”, “Fit to whole page”, “Fit to page width”, “Actual size” 
 ShowStatusBar   Show or not status bar 
 ShowStatusBarGrip   Show or not Grip on the status bar 
 ShowToolBar   Show or not toolbar 

Report Viewer has Actions property that provides access to all actions and allows you to define it. Here is the list of all actions.

 Action   Description  
 Print   Called when “Print document” button is clicked 
 Load   Called when “Open document” button is clicked 
 Save   Called when “Save document” button is clicked 
 Export   Called when “Export document” button is clicked 
 Pan   Called when “Pan mode” button is clicked 
 DynamicZoom   Called when “Dynamic zoom mode” button is clicked 
 ZoomIn   ZoomIn Called when “Zoom in mode” button is clicked 
 ZoomOut   Called when “Zoom out mode” button is clicked 
 ZoomRectangle   Called when “Zoom to rectangle” button is clicked 
 Content   Called when “Show Content” button is clicked 
 WholePage   Called when “Fit to whole page” button is clicked 
 PageWidth   Called when “Fit to page width” button is clicked 
 ActualSize   Called when “Actual size” button is clicked 
 Zoom25   Sets zoom 25% 
 Zoom50   Sets zoom 50% 
 Zoom100   Sets zoom 100% 
 Zoom125   Sets zoom 125% 
 Zoom150   Sets zoom 150% 
 Zoom200   Sets zoom 200% 
 Zoom300   Sets zoom 300% 
 Zoom500   Sets zoom 500% 
 Forward   Called when “Move forward” button is clicked 
 Backwards   Called when “Move backwards” button is clicked 
 CustomZoom   Called when the following hotkey is pressed Ctrl+Z or “Custom zoom” contextual menu item is selected for the Zoom block on the status bar 
 FirstPage   Called when “Go to first page” button is clicked 
 PrevPage   Called when “Go to previous page” button is clicked 
 NextPage   Called when “Go to next page” button is clicked 
 LastPage   Called when “Go to last page” button is clicked 
 GotoPage   Called when you click mouse on the status bar that displays information on the current page and total count of pages. 
 EditReport   Called when “Edit report” button is clicked 
 RefreshReport   Called when “Refresh report” button is clicked 
 SinglePage   Called when “Single page mode” button is clicked 
 ContinuedPage   Called when “Continued page mode” button is clicked 

In order to redefine the action set by default, it is necessary to create Executing event handler. If the Handled property of the ExecutingEventArgs object delegated to the event handler is set to true, then standard action defined in the Execute event won’t be called. For example, to redefine Export action:

reportViewer1.Actions["Export"].Executing += 
new Action.ExecutingEventHandler(Export);

and create event handler:

private void Export(object sender, ExecutingEventArgs e)
{
  // Do something
  e.Handled = true;
}

Add Feedback