How to create an interactive Web report with outlines and bookmarks

Source: Internet
Author: User

Interactive reports allow users to interact with them. For example, a report can contain hyperlinks, bookmarks, and outlines. By clicking the title of the outline section, you can navigate to the desired location in the report. Such reports are often used in the product catalog. (See more Web Reporting Tutorials)

Let's create one of these interactive reports for the Web. To do this, we need a report template and a Web application.

Let's start with the report first. Its template will consist of two pages-content, and pages that contain data. For example, I'm using the Nwind.xml database that Fastreport.net delivers.

So, we use forms: Categories and products. I created a simple template with a "categories.categoryname" field.

By clicking on the category, the user will be moved to the appropriate section. We'll talk about this feature later.

Now create the second page of the report first. Here, the "data" band will contain a detail band. To add it, right-click the data Band and select Add Detail band from the list.

For detailed data bands, you need to add a title. To do this, click on the "Configure band (Configure bands) ..." button. In the window that appears, select the detail Data band, and then click the Add button. Select "Header":

Drag the Categories.categoryname, Categories.description, and Categories.picture fields to the main data strip.

I also want to add a link to the first page of the report. The template will resemble the following:

We add a hyperlink to "go to the first page". Right-click the label and select Hyperlink. In the Hyperlink editor, select the page Number tab. and set its value to 1:

Now we'll handle the detail data strip. Drag the ProductName, UnitPrice, UnitsInStock, and discontinued fields from the Products table onto it. The page template looks like this:

To implement the navigation function, we need to set some properties of the first Data band. Select the band and find "Outlineexpression" in the property viewer. Input value-[categories.categoryname]. Just above the property, there is a bookmark (bookmark). Set the same value for it.

For detailed data bands, we set the outline properties-[Products.productname].

Now go back to the first page. We set the Hyperlink property for the "Categories.categoryname" field. In the Hyperlink editor, select the Bookmarks tab and set the expression [Categories.categoryname]:

Now I want to show page numbers next to each category name. Add a text box next to the category name and set the following text: [Engine.getbookmarkpage ([Categories.categoryname])]

This feature displays the page number of the bookmark.

Let's add a hyperlink to this text box:

To display the number of pages with bookmarks, you must first create a report. However, our page number is on the first page of the report, so the report engine does not know the page number of the bookmark. In order for our functionality to work, you need to enable the Doublepass property for the report. It will allow you to run the report two times. The first time is to get the page number of the bookmark, and the second is to display the numbers on the first page of the report. To find this property, select the Report object from the drop-down list in the property Inspector:

The report is ready. Now create an ASP. NET MVC project. Please add Fastreports library references: FastReport.dll and FastReport.Web.dll.

I will display the report object on the first page of the site, so we use the controller HomeController:

Using fastreport.web;using System.Web.UI.WebControls; Public ActionResult Index () {Webreport webreport = new Webreport ();//create instance of Web report objectstring REPORT_PA th = "J:\\program Files (x86) \\FastReports\\FastReport.Net\\Demos\\Reports\\"; Set reports PathSystem.Data.DataSet DataSet = new System.Data.DataSet (); Create Data Setdataset.readxml (Report_path + "Nwind.xml"); Load XML db to Data SetwebReport.Report.RegisterData (DataSet, "NorthWind"); Register data set in Reportwebreport.height = Unit.percentage (100); Set Report Heightwebreport.width = unit.percentage (100); Set report WidthwebReport.Report.Load (Report_path + "Interactivecomplexreport.frx"); Load report Viewbag.webreport = Webreport; Pass to Viewreturn View (); }

Now we edit the view home-> index.cshtml. Leave only the title of the report and the report displayed:

@{viewbag.title = "Home page";} @ViewBag. webreport.gethtml ()

Add scripts and styles to a file shared-> _ Layout.cshtml:

Add a namespace to the file "views->. config":

<namespaces> <add namespace= "Fastreport"/> <add namespace= "Fastreport.web"/> </namespaces>

Add a processing handle to the file "Web. config" in the project root directory:

<system.webServer>  

Well, that's it. Run the application, and the following is the first page of the report:

Pick a category and jump to its location:

To return to the content, click Back to Home.

Now, let's use the icons in the Web Report toolbar to export the report to Adobe Acrobat format.

Here we use the Outline property. A detailed report outline will be available on the left side of the page.

That's why you can make your Web reports more appealing and easier to use. As I pointed out at the outset, this interactive report is ideal for presenting the product catalog.

Product Introduction | Download Trial | Promotions | Online Customer Service | Contact Elyn

Recommended Reading
    • How to add a drop-down list to a Web report
    • How to connect a MySQL database to a report
    • How to create an interactive Web report in an MVC project
    • How to print a report quickly in MVC
    • How to download a report as an Excel document in MVC
    • How to include multiple reports in a Webreport object
    • Fastreport.net v2018.1 version update has been released! (download included)
This site is reproduced in addition to the article, are the original site or translation
Welcome to any form of reprint, but please be sure to indicate the source, respect for the results of others ' work
Reprint Please specify: Article reprinted from: Fastreport control Chinese web [http://www.fastreportcn.com/]
This address: http://www.fastreportcn.com/post/1951.html

How to create an interactive Web report with outlines and bookmarks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.