ActiveReports allows you to add hyperlinks to reports. The hyperlink property can be set to any HTML-style link such as http:// or mailto://.
This walkthrough illustrates how to add to add hyperlinks to a report in the PageFooter section.
This walkthrough is split up into the following activities:- Adding an ActiveReport to a Visual Studio project
- Connecting the report to a data source
- Adding controls to the report to display data
- Viewing the report
To complete the walkthrough, you must have access to the Northwind database.
When you have completed this walkthrough, you will have a report that looks similar to the following.
Adding an ActiveReport to a Visual Studio project
To add an ActiveReport to a Visual Studio project
- Open a new project in Visual Studio.
- From the Project menu, select Add New Item.
- Select ActiveReports 3.0 File and rename the file rptHyper.
- Click Open.
Connecting the report to a data source
To connect the report to a data source
- Click the gray report DataSource icon in the Detail section to open report DataSource dialog.
- Select the "OLE DB" tab.
- Click Build.
- Select Microsoft Jet 4.0 OLE DB Provider and click Next.
- Click the ellipsis to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
- Click OK to continue.
- In the Query field, type "Select * from suppliers order by CompanyName".
- Click OK to return to the report design surface.
Adding controls to display the data
To add controls to the reports
- Add a GroupHeader/Footer section to rptHyper by right-clicking the design surface of the report and selecting Insert > Group Header/Footer.
- Make the following changes to the group header:
- Change the name to ghSuppliers
- Change the DataField property to CompanyName
- Change the GroupKeepTogether property to All
- Change the KeepTogether property to True
- Add the following controls to the GroupHeader section:
Control Name Text Location Label lblCompanyName Company Name 0, 0 Label lblContactName Contact Name 1.562, 0 Label lblPhone Phone # 2.687, 0 Label lblFax Fax # 3.812, 0 Label lblHomePage1 Home Page 4.875, 0 - In the Report Explorer, expand the Fields node, then the Bound node. Drag the following fields onto the detail section and set the following properties of each textbox.
Field Text Location CompanyName Company Name 0, 0 ContactName Contact Name 1.562, 0 Phone Phone 2.687, 0 Fax Fax 3.812, 0 HomePage Home Page 4.854, 0 - Add the following controls to the PageFooter section:
Control Name Text Miscellaneous Location Label lblEmail Need Assistance? E-mail Support: Support@company.com HyperLink = mailto:support@company.com 0, 0.125 Label lblHomePage Visit our home page: www.datadynamics.com HyperLink = www.datadynamics.com 0, 0.375
Viewing the report
To view the report
- Add the ActiveReports viewer control to a Windows Form.
- Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports Windows Form Viewer for help.
You can quickly view your report at design time by clicking the Preview tab at the bottom of the designer. |