Devexpress releases the free lightswitch print report control.

Source: Internet
Author: User
Tags visual studio 2010

The expected message finally appeared. Add to favorites for backup.

1) first look at the devexpress lightswitch reporting Control

Http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/32/First-Look-At-The-DevExpress-LightSwitch-Reporting-Control.aspx

2) How to: Use xtrareports in lightswitch applications

Http://documentation.devexpress.com/#XtraReports/CustomDocument9901

Xtrareports> examples> How to: Use xtrareports in lightswitch applications

This tutorial will guide you through the process of creating a simple lightswitch application containing a report using Microsoft Visual Studio 2010 or Visual Studio lightswitch. you will learn how to add a report to a lightswitch application and bind it to a data source.

To create a data-aware report in a lightswitch application, do the following.

  • Create a lightswitch application with an xtrareports Extension
  • Add a data source to the application
  • Add a Report to the application
  • Bind the report to data and adjust its layout
  • Add a screen and show the report
  • View the result
Create a lightswitch application with an xtrareports Extension

  1. Run Microsoft Visual Studio 2010 or Visual Studio lightswitch.

  2. Start a new project (CTRL + Shift + n) and create a newLightswitch Application.

  3. Switch to the Solution Explorer (CTRL + ALT + l), right-clickApplication1, And in the invoked menu, clickProperties.

  4. Then, in the Application Designer, switchExtensions, And enable the check box nearDevexpress. xtrareports. lightswitchExtensions, to add it to the application.

    ClickSaveTo apply the changes, and close the Application Designer.

  5. Back in the Solution Explorer, right-clickData sourcesFolder and in the invoked menu, clickAdd data source...

  6. On the first page of the invoked wizard, chooseWCF Ria ServiceAnd clickNext.

  7. On the next page,XtrareportsserviceIs selected by default, so clickNext.

  8. On the last page, choose to include all entities and clickFinish.

Note

We do not recommend you change the data source name from its default value (Xtrareportsservicedata), As well as names of other auto-generated entities and their attributes. Otherwise, the application will not work.

Add a data source to the application

Although the following steps demonstrate how to use an external data source in your lightswitch application, xtrareports fully supports working with intrinsic data sources as well.

  1. In the Solution Explorer, right-clickData sourcesFolder and in the invoked menu, clickAdd data source...

  2. At this time, chooseDatabaseIn the wizard, and clickNext.

  3. In the invokedChoose Data SourceDialog, chooseMicrosoft SQL ServerAnd clickContinue.

  4. Next, inConnection PropertiesDialog, specify the server name, Authentication Mode and your database name.

    Test the connection and clickOKTo proceed.

  5. On the last Wizard Page, select the required table (s), and clickFinish.

Add a Report to the application

  1. In the solution Editor, switch toFile View.

    Then, right-clickServer, And in the invoked menu, chooseAdd|New item...

  2. InAdd new itemDialog, selectXtrareport class v11.1Item, and clickAdd.

Bind the report to data and adjust its layout

  1. After the report is added, re-build your application.

    Then, click the report's smart tag and in its actions list, invoke the drop-down list for the xtrareportbase. datasource property and choose the existing data source.

  2. Following this step, the field list reflects the structure of your report's data source, and can be used to create data-aware controls.

  3. To group A report's data, use the group and sort panel. To show this panel, right-click your report and in the invoked menu, chooseTool WindowsAnd clickGroup and sort.

    Then, group the Report byCountryField...

    ... And drop the corresponding item from the field list onto the created group header band.

  4. To provide a document map to your report, bind the xrcontrol. Bookmark property of the created xrlabel to the same data field.

Add a screen and show the report

  1. In the Solution Explorer, selectScreens, And in the invoked menu, chooseAdd screen...

  2. InAdd new screenDialog, selectList and detail Screen, And setScreen dataTo the selected table.

  3. In the Application Designer, right-clickScreen command bar, And chooseAdd button...

  4. InAdd buttonDialog, specify the name for the corresponding method, and clickOK.

  5. HandleExecute ()Method of the button, and callReportpreview. Show ()Method with the specified report name (including its namespace ).

C # VB
partial void ShowTheReport_Execute() {    ReportPreview.Show("LightSwitchApplication.XtraReport1");}
Private Sub ShowTheReport_Execute()    ReportPreview.Show("XtraReport1")End Sub 
C #
partial void ShowTheReport_Execute() {    ReportPreview.Show("LightSwitchApplication.XtraReport1");}
VB
Private Sub ShowTheReport_Execute()    ReportPreview.Show("XtraReport1")End Sub 
View the result

Run the application and clickShow the report.

The result is shown in the following image.

See also

Current limitations of lightswitch reporting

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.