Search Results for

    Show / Hide Table of Contents

    WCF service library FastReport.Service.dll

    FastReport .NET contains the library FastReport.Service.dll, which is designed for integration into applications on the .NET Framework version 4.6.2 and above.

    This library is a WCF Service Library and is intended for use in custom applications that perform the functions of the service.

    The library contains the following functions:

    List<ReportItem> GetReportsList();
    

    Returns a list of available reports. Each item is returned as a 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 the result of building a report. Parameters report and gear can be used from the lists previously obtained, or by creating new objects with the required properties. The returned stream does not support positioning.

    Let's look at list elements.

    ReportItem

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

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

    Name – name of the report, taken from the metadata of the report. If the metadata of the report contains an empty name then the property contains a filename without an extension. This property can be used to build an interactive list of available reports in your application (eg: in a ListBox).

    Description – description of the report, taken from the metadata of the report.

    Dictionary<string, string> Parameters – dictionary of report parameters, may be 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 – name of the format. May contain one of the following strings:

    Name Description
    PDF Adobe Acrobat file.
    DOCX Microsoft Word 2007 file.
    XLSX Microsoft Excel 2007 file.
    PPTX Microsoft PowerPoint 2007 file.
    RTF Rich Text file – supported by many text editors.
    ODS Open Office Spreadsheet file.
    ODT Open Office Text file.
    MHT Compressed HTML file together with the images, can be opened in Internet Explorer.
    CSV Comma separated values file.
    DBF dBase file.
    XML Excel XML table – without images.
    TXT Text file.
    FPX FastReport .NET Prepared report file. It can be opened in the Viewer.exe program for viewing or loaded directly into a report object from code using the Report.LoadPrepared(stream) method, after which the report can be displayed on the screen using the Report.ShowPrepared() method.

    Dictionary<string, string> Properties – dictionary of parameters of a report. A complete list of supported parameters with default values is available on requesting the server to list formats.

    When creating a service you must add the following lines in your App.config or Web.config:

    <appSettings>
     <add key="FastReport.ReportsPath" value="C:\Program files\FastReports\FastReport .NET Professional\Demos\Reports" />
     <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 – 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 – list of available formats. You can select only those required and change the order of the names.

    Schematic of using FastReport.Service:

    And, if you already know exactly what to report and in which format to receive it (this reduces the number of queries made to the service):

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

    • dialogs in the reports are not supported and will be ignored;

    • each report must include an internal DataConnection, whose connection string for the report service is replaced by a string from the configuration.

    Examples of use of FastReport.Service.dll can be found in the folders \Demos\C#\Web\WCFWebService and \Demos\C#\Web\WCFWebClient.

    An example configuration file service - FastReport.Service.dll.config.

    Back to top © 1998-2025 Copyright Fast Reports Inc.