The Standard Edition Web sample demonstrates a method to view a report at client side in HTML or PDF format. Application structure consists of ASP.NET website, using which the report is streamed to the client as HTML or PDF. This sample describes custom exporting without the Pro Edition server controls or RPX handlers as well as running reports on the server. The PDF and HTML exports allow you to manually control exporting by writing a little code in ASP.NET language. Steps explained in this sample can be used for both Standard and Professional editions.
Sample Location
Visual Basic.NET
<User Folder>\Documents\GrapeCity Samples\ActiveReports 11\Standard Edition Web\VB.NET
C#
<User Folder>\Documents\GrapeCity Samples\ActiveReports 11\Standard Edition Web\C#
Run-Time Features
When you run the sample, the Default.aspx page appears in your browser. This page provides two links to other reports that demonstrate custom PDF or HTML export options.
Clicking the Custom Exporting PDF Example option opens the Invoice report and clicking Custom Exporting HTML Example option opens NwindLabels report in the Default.aspx page.
Note: To run this sample, you must have access to the Nwind.mdb. A copy is located at [User Documents folder]\GrapeCity Samples\ActiveReports 11\Data\NWIND.mdb. If you are unable to access the data files in the sample, create the Data folder and place all the data files to this folder, or change the reference path to the data files within the folder according to your environment.
Project Details
Reports folder
The Reports folder contains two rpx reports - the Invoice report and the NwindLabels report.
Invoice Report
The Invoice report uses three GroupHeader sections, a Detail section and a GroupFooter section as well as a label in the PageFooter section to display data.
ghOrderHeader section
This section also contains a Picture control, a number of Label controls, and two bound TextBox controls. The TextBoxes are bound using the DataField property in the Properties window, and the date is formatted using the OutputFormat property.
ghOrderID section
This section contains a number of labels and bound text boxes, as well as two Line controls.
ghTableHeader section
Detail section
GFOrderID section
This section contains several labels and several TextBoxes. Two of the TextBox controls use the following properties to summarize the detail data: SummaryFunc, SummaryGroup, and SummaryType. For more information, Create a Summary Report.
The Total TextBox does not use the DataField property or any of the summary properties, or even any code. To find the functionality of this TextBox, in design view, click the Script tab at the bottom of the report.
PageFooter section
NwindLabels Report
TheNwindLabels report only uses the Detail section to display the report data.
Detail section
This section contains bound TextBox controls and Label controls. This section prints 30 labels per 8½ x 11 sheet.
The Detail section uses the CanGrow property set to False to maintain the label size and the ColumnCount, ColumnDirection, and ColumnSpacing properties to accommodate multiple labels in a single page.
ActiveReports.ReportService.asmx
The report web service required for the proper functioning of the Web Viewer. The ActiveReports.ReportService.asmx is added automatically to the project when you place the WebViewer control on the form. You can also add this service by using Add New Item in the Visual Studio Project menu.
For the information on how to use the WebViewer control, see Getting Started with the Web Viewer.
CustomExportHtml.aspx
This Web form is displayed by clicking the Custom Exporting HTML Example option on the Default.aspx page.
In CustomExportHtml.aspx, report is outputted to the ReportOutput folder using the CustomHtmlOutput class and the exported HTML is displayed in the browser. The CustomHtmlOutput class implements the required IOutputHtml in the HTML export and saves the output results to a file with a unique name.
CustomExportPdf.aspx
The Web form is displayed by clicking the Custom Exporting PDF Example option on the Default.aspx page.
In CustomExportPdf.aspx, the report is exported to memory stream and then outputted in the browser.
Default.aspx
This is the main Web form of the sample that shows the introductory text and links to other sample pages that demonstrate the following web features.
Web.config
This configuration file contains the httpHandlers that allow ActiveReports to process reports on the Web.
Note that you need to manually update version information here when you update your version of ActiveReports.