FastReport WCF Service Library

2013-06-10

Today we will talk about the new library FastReport.Service.dll which appeared in FastReport.Net 2013.3. This library is a WCF Service Library and is intended for use in custom services.

FastReport WCF Service Library

Now library contains the following features:

 List<ReportItem> GetReportsList();
 List<ReportItem> GetReportsListByPath(string path);
 List<GearItem> GetGearList();
 Stream GetReport(ReportItem report, GearItem gear);

List<ReportItem> GetReportsList() returns a list of available reports. Each item presens as ReportItem object. Reports are stored on a hard drive on a server that is running the service. Files are sorted in alphabetical order.

List<ReportItem> GetReportsListByPath(string path) – returns a list of available reports by path. Files are sorted in alphabetical order.

List<GearItem> GetGearList()  - returns a list of available formats that can generate service reports as elements GearItem.

Stream GetReport(ReportItem report, GearItem gear) returns a stream of result of building a report. Parameters report and gear can be used from the list of previously obtained, or create new objects with the required properties. The returned stream does not support positioning.

 

ReportItem

 public class ReportItem
 {
 public string Path;
 public string Name;
 public string Description;
 public Dictionary<string, string> Parameters;
 }

Paththe path to the report file on the server, relative to the root folder for storing reports. The file extension of the report can only be *.frx. This property is used to identify a specific report with further queries.

Namename of the report is taken from the metadata of the report. If the metadata of the report contain an empty name then prperty contain a filename without an extension. This property can be used to build an interactive list of available reports in your application (such as ListBox).

Descriptiondescription of the report is taken from the metadata of the report.

Dictionary<string, string> Parameters Dictionary of report parameters maybe filling parameters, which will be subsequently transferred to the report. It supports only the string values that must be considered when designing a report template.

 

GearItem

 public class GearItem
 {
 public string Name;
 public Dictionary<string, string> Properties;
 }

Namethe name of the format. May contain one of the following strings:

Name

Description

PDF

File of Adobe Acrobat

DOCX

File of Microsoft Word 2007

XLSX

File of Microsoft Excel 2007

PPTX

File of Microsoft PowerPoint 2007

RTF

File of Rich Text – supported by many text editors

ODS

File of Open Office Spreadsheet

ODT

File of Open Office Text

MHT

Compressed HTML file together with the images can be opened in Internet Explorer

CSV

Comma separated values

DBF

File of dBase

XML

XML table of Excel – without images

TXT

Text file

FPX

Prepared report of FastReport.Net, maybe loaded in Viewer.exe or in report object from your code Report.LoadPrepared(stream); Report.ShowPrepared()

Dictionary<string, string> PropertiesDictionary of parameters of a report. A complete list of supported parameters with default values is available upon request from the server to the list of formats.

 

You need to add the following lines in your App.config or Web.config.

 <appSettings>
 <add key="FastReport.ReportsPath" value="C:\Program files\FastReports\FastReport.Net\Demos\WCF" />
 <add key="FastReport.ConnectionStringName" value="FastReportDemo" />
 <add key="FastReport.Gear" value="PDF,DOCX,XLSX,PPTX,RTF,ODS,ODT,MHT,CSV,DBF,XML,TXT,FPX" />
 </appSettings>

FastReport.ReportsPathspecifies the path to the folder with the reports, a list of which will be transmitted to the client.

FastReport.ConnectionStringName the name of the connection string to the database, which is stored in the configuration section <connectionStrings>. Used to replace the internal connection string in the report template.

FastReport.Geara list of available formats. You can select only the necessary and change the order of the names.

Schematic a use of FastReport.Service:

 

FastReport WCF Service Library

 

If you know exactly what to report and what format you want to receive (it will reduce the number of queries to the service):

FastReport WCF Service Library

 

Important points when you create report templates for use in the services:

  • dialogs in the reports are not supported and will be ignored;
  • Each report shall include an internal DataConnection, which will connect string for the report service is replaced by a string from the configuration.

Examples of use FastReport.Service.dll can be found in the folders \Demos\C#\WCFWebService , \Demos\C#\WCFWindowsService , \Demos\C#\WCFWebClient , \Demos\C#\WCFClient. An example configuration file service - FastReport.Service.dll.config.

I'll talk more about specific examples of the use of FastReport.Service.dll in future articles.

To be continued.

August 12, 2024

How to build and install the Postgres plugin in FastReport .NET

This article describes how to connect to the database using the FastReport .NET plugin for the report designer from Visual Studio via the NuGet server.
August 08, 2024

How to install FastReport .NET and its components on Windows

Step-by-step instructions for online and manual installation via the FastReport registration code.NET and its components in Windows.
July 26, 2024

Updating HTMLObject as a plugin for FastReport .NET

Detailed instructions for using the new HTMLObject plugin, which uses splitting DOM HTML into FastReport report objects.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.