Quantcast
Channel: Developer Express Inc.
Viewing all articles
Browse latest Browse all 2370

Embedded HTML5 Designer/Viewer and Improved Report Server API (Coming soon in v14.2)

$
0
0

This edition of the DevExpress Data Blog will feature some of the new things happening with our DevExpress Report Server in our upcoming 14.2 release.

New HTML5/JS Report Viewer

We’ve been hard at work making the Silveright Report Viewer an optional feature of the DevExpress Report Server. Coming in 14.2 there is now a configurable option to use either the old Silverlight Report Viewer or the brand-new HTML5/JS Report Viewer:

HTML5 Report Viewer Option

Here it is in all of its glory:

HTML5 Report Viewer

Now reports can be viewed on any computer (or even device) as long as it boasts a modern browser. Now I know the next question: will the new viewer be available as a standard web control? Well, kind of – more on this next week. This brings us to the next feature!

Embedded HTML5/JS End User Designer

We’ve gone ahead and incorporated our new Web End User Report Designer directly into our Report Server (more on our 14.2 edition of our HTML5/JS Designer later).

HTML5 Report Editor

This is seriously a fantastic development! Now editing reports is not confined to people using Windows, but everyone! A caveat: if you have installed the new 14.2 beta, you may have noticed that the new Designer has been enabled for editing reports – not creating new ones. Why the limitation you ask? Currently you can add a large collection of tables, views and stored procedures when creating Data Models. Generally a Data Source (note the distinction here) is a subset of the items reflected in the Data Model. We are still working on a way to create Data Sources from Data Models. Once this process is ironed out we will be able to create new reports using the Web End User Designer.

Improved Report Server API

Connecting to the DevExpress Report Server is really simple:

using DevExpress.ReportServer.ServiceModel.Client;
using DevExpress.ReportServer.ServiceModel.ConnectionProviders;
using DevExpress.ReportServer.ServiceModel.DataContracts;
// ...

// Create a connection provider.
ConnectionProvider connection = new GuestConnectionProvider("http://127.0.0.1:83");
// Initialize a report server client.
IReportServerClient client = connection.ConnectAsync().Result;
// Place your code here to interact with the a report service using the created client.

Notice that the new API is Task-based, so you can easily write asynchronous code and even use async/await. Here's a taste of how to export a report from a .NET Console Application:

static void Main(string[] args) {
    const string serverAddress = "https://reportserver.devexpress.com/";
    const string targetFileName = @"c:\temp\CustomerOrderHistory.pdf";
    const int reportId = 1113;
    ReportParameter parameter = new ReportParameter() { Name = "@CustomerID", Path = "@CustomerID", Value = "ALFKI" };

    ExportToPdf(serverAddress, targetFileName, reportId, parameter);
}

static void ExportToPdf(string serverAddress, string fileName, int reportId, params ReportParameter[] parameters) {
    ServiceOperationBase.DelayerFactory = new ThreadingTimerDelayerFactory();

    IReportServerClient client =
        new GuestConnectionProvider(serverAddress).ConnectAsync().Result;
    //new ServerUserConnectionProvider(serverAddress, "demo", "demo").ConnectAsync().Result;
    //new WindowsUserConnectionProvider(serverAddress).ConnectAsync().Result;

    Task exportTask = Task.Factory.ExportReportAsync(client, new ReportIdentity(reportId), new PdfExportOptions(), parameters, null);
    File.WriteAllBytes(fileName, exportTask.Result);
}

Although the type of interaction has been available in our 14.1 release (see T155725 and E5062), we've added a whole slew of Task-based methods for many of the common Report Server scenarios.

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez


Viewing all articles
Browse latest Browse all 2370

Trending Articles