logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Forgot password?
    • en
    • ru
    • pt
    • es
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • FastReport WCF Service Library
  • Creating the WCF service hosted in windows service

    August 1, 2013

    Today we will create a Windows service, which will serve as the WCF service. An

    read more
  • How to use SVGObject in FastReport .Net 2018.2

    May 20, 2018

    Format SVG (Scalable Vector Graphic) was developed in the late 90's to display vector graphics

    read more
  • How to connect to SQLCe

    November 11, 2019

    Microsoft SQL Server Compact Edition is a simple local relational database that doesn't require installation,

    read more
  • How to connect to the Sybase SQL Anywhere database

    February 29, 2020

    Sybase SQL Anywhere database has a number of very useful features that make it very

    read more
  • How to create business cards from a WinForms application

    May 28, 2020

    As you can see from the name, Windows Forms type of applications is designed to

    read more

FastReport WCF Service Library

June 10, 2013

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;
 }

Path – the 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.

Name – name 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).

Description – description 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;
 }

Name – the 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> Properties – Dictionary 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.ReportsPath – specifies 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.Gear – a 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.

about product download buy
avatar
Aleksandr Fediashov
Chief Development Officer
.NET WCF FastReport

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Our team
  • Contact us

© 1998-2021 by Fast Reports Inc.

  • Privacy Policy