Types of solutions for generating reports and documents

FastReport .NET

Sets of components that simplify and automate the process of creating reports and documents in C# for diverse technologies.

FastReport VCL

Sets of VCL, FMX, and Lazarus components with full sources codes for creating reports and documents in Delphi and Pascal.

WEB reporting

Components for cross-platform projects to develop, build, display, print, and export reports directly in the browser.

Solutions for end-users

Independent software solutions for designing, building, converting, and viewing ready-made reports on your computer.

OLAP and Business Graphics

Data presentation and analytical processing tools for obtaining pivot tables with subsequent visualization based on Business Graphics.

Service solutions

Ready-made services and client-server systems for fast data visualization and automatic execution of information processing tasks.

News

April 22, 2025

Update of Delphi and Lazarus Products To 2025.2 Version

Get ready for the highly anticipated update for the entire line of Delphi and Lazarus products! With version 2025.2, you’ll enjoy exciting new features, including an easy-to-use tool for configuring watermarks, an updated set of server components, a brand-new dialog page mechanism for web reports, and the innovative TfrxDeviceCommand report object for RFID tags. We've also made significant enhancements to the reporting engine, improved export and transport options, added theme support, and much more! Upgrade your product today and unlock a world of new possibilities with us!     New Features in FastReport VCL User-Friendly Watermark Customization Tool   A customizable watermark feature has been added for report pages. Watermarks are often used for document protection or to indicate the type of document. We have introduced an easy-to-use tool that allows you to configure watermarks for each page of the report effortlessly. Any page in the report can have multiple watermarks, enabling individual customization for print, display, or export. Watermarks can utilize both images and text, with a wide range of customizable parameters (text rotation, style). Watermarks can be set up both in the report designer and in the preview mode.   Update of Server Components   With the release of 2025.2, all available export filters from FastReport VCL are now also available in server components. Take advantage of all these formats in your web application.   New Mechanism for WEB Report Dialog Pages   The completely revamped mechanism allows for the use of container objects such as PageControl and groups, as well as extending the functionality of available controls on the dialog page for web dialogs. In this update, we have expanded support for new components for dialog pages. Specifically, we have added dialog page controls that were not previously available in WEB. List of new dialog form controls: Date picker — date picker DBComboBox — drop-down list linked to a data source\ List Box — selection list CheckListBox — selection list (with checkboxes) MaskEdit (without mask) —Input field Password edit —input field for password PageControl —creating pages with tabs GroupControl — grouping panel Panel — panel You can now also apply a custom HTTP header for your projects.   New TfrxDeviceCommand Report Object  This non-visual object is designed to send commands to devices (exports) that can process these commands. In the current version, the object contains a settings class for RFID tags. RFID tags transmit non-visual data to the ZPL export to write this data to the chip using specialized equipment. The RFID tag class has its own editor and set of properties for precise adjustment of the information being written. You can read more in our article. Read the article The TfrxPDFView report object now allows you to configure the range of pages to be output. You can set values using expressions in the TfrxPDFView.PagesRange property. Thus, you have access to filtering the output pages for a PDF document.     Changes in the Report Engine Combining Object Output Techniques New changes to the report engine allow you to combine different object output techniques, giving you the freedom to create complex reports with a variety of options. The operation of the bottom alignment mechanism (baBottom) of a growing band has been changed when one of the band's objects is split into several parts (pages). In the old implementation, an object with the baBottom property is displayed on the very first part of the data break. The new mechanism for operating such a report corrects objects with baBottom, placing them on the last part of the data (at the end of the band). Please note that this behavior of the report engine is considered correct and should be taken into account when developing reports.   Support for smMaxHeight Stretching for a Static Table (AllowSplit rows only) The smMaxHeight stretching in a table works differently than in objects. The desired height is set for the entire table on the band. Then it is distributed among the rows with the AllowSplit=True property set and AutoSize=False disabled. Rows with the MaxHeight value are also taken into account. This approach allows you to choose which rows of the table can be stretched to fill the empty space, and which cannot.   New TfrxRichView Report Object Splitting Behavior The RichText object allows you to use tables, images, and other objects that cannot be split for a specific size. Such objects could sometimes create entire non-splittable blocks of content that extended beyond the page. In the current version, TfrxRichView splitting has been reworked and works selectively depending on the situation. Finding the smallest splittable part. If an object contains a part that cannot fit on a new page and is non-splittable (an object or table row is larger than the height of the entire sheet). Then the smallest "non-splittable" part is now found for such a part and is displayed as is. Splitting does not stop. If there are other parts, they will also be split and output. The main difference from the old mechanism is the search for the smallest value for the non-splittable part and the continuation of the build. Previously, all content fell into the "non-splittable" part and the separation stopped there, and some of the text could be lost. Finding the largest splittable part. If a part is encountered that cannot fit on a new page, but it is splittable, such as the same table, then a search for the largest splittable part will be performed and the output will continue.     Report Designer Added Theming Support (Runtime Themes) The report designer and its components have been adapted to support themes, both system and custom. Now the report designer will always be in the same style as your application! In Rad Studio 12.3, work with monitors with high display scaling was improved. This change is aimed at improving the quality of visualization and usability of the interface in the development environment when working on monitors with high resolution and scaling settings. In this update, the dialog editor in the report designer has been redesigned. Now this is a fixed workspace, just like the report page. The position of the dialog can be changed through the object inspector. Improved Code completion in the report code editing window. For your convenience, a pop-up menu has been added for the watch list window. We also redesigned the "Designer Options" window for the best support for small screen resolutions.   Exports and Transports Support for user-defined characters has been implemented in PDF and SVG exports (EUDC). Also improved alignment of RTL text with ligatures. Added support for ZUGFeRD 2.3 with the following profiles: “MINIMUM”,” BASIC WL”, ”BASIC”, ”EN 16931”, ”EXTENDED”, ”XRECHNUNG”. An example with the inclusion of data for this format can be found in InvoiceDemo, which comes with the product. In the new version, the mechanisms for exporting to XLSX and DOCX formats have been improved. This has enhanced the quality of the generated documents and expanded their customization options. The e-mail (SMTP) transport has been improved with native support for TLS\STARTTLS and support for XOAUTH authorization. Use secure channels to send your reports.     FastReport Lazarus In addition to the fundamental changes that have been included in the VCL and Lazarus versions, FastReport for Lazarus has received support for high-resolution monitors (HiDPI).     FastCube VCL and FMX In the VCL version of FastCube, all TTreeView controls have been replaced with TfrTreeView. All versions received filter indication in the list of available fields. The FMX version received the ability to save Custom Filter and Custom Group, as well as a number of improvements and fixes.     FastQueryBuilder Added support for high-resolution monitors (HiDPI).     FastScript In this update, we have implemented Android support. This innovation works only when compiling with strings that are indexed starting from one. You can use all the power of the script engine in your mobile Android applications. Added support for classes for working with XML and JSON. You can read more about how to work with these formats using the example of loading data into a report in this article. Read the article     FastReport VCL Controls For the TfrShellTreeView control, it became possible to create custom nodes and shortcuts to other nodes. You can read about how to configure TfrShellTreeView and add custom nodes in this article. Read the article     Installer You can now install our products with Android support. Also, support for installing packages on the 64-bit version of the IDE Embarcadero RAD Studio 12.3 has been added.     Complete List of Changes: 2025.2 version ========================   VCL.Core [Localization]- Fixed sorting in LocalizationEditor;   VCL.Controls [Engine]+ Added the ability to create a custom structure of root Shell Node and regular Node;- Fixed HiDPI support in smartMemo;- Fixed the behavior in which the control is not scaled when Parent is assigned when csFreeNotification is set in ComponentState;- Fixed some shortcomings in the rendering of TfrTreeView and TfrShellTreeView; [UI]- Fixed custom color rendering and disabled state for tfrTreeView; Lazarus.Controls [Engine]+ Added the ability to create a custom structure of root Shell Node and regular Node;- Fixed HiDPI support in smartMemo; [UI]- Fixed custom color rendering and disabled state for tfrTreeView;- Implemented HiDPI support for Lazarus;- Fixed some shortcomings in the rendering of TfrTreeView and TfrShellTreeView;   VCL.FastCube [UI]+ Added filter indication to the list of available fields;+ Added the ability to save Custom Filter and Custom Group;• TreeView replaced with TfrTreeView;- Fixed localization of the FastCube toolbar;   FMX.FastCube [UI]+ Added filter indication to the list of available fields;+ Added removal of ActivePopup in TfcxSliceGrid.FullUpdate;• TreeView replaced with TfrTreeView;- Fixed localization of the FastCube toolbar;- Fixed incorrect operation of the TfcxRangesEditor form;- Fixed the problem of positioning and visibility of the "OK", "Cancel" buttons;- Fixed FastCube FMX error in the selection rules editor;- Fixed the operation of incremental search in drop-down lists; [Engine]+ Added the ability to save Custom Filter and Custom Group;- Fixed an error when clicking in the Top-N filters list area after zeroing TfcxSliceGrid.Slice := nil;   Lazarus.FastCube [UI]+ Filtering indication added to the list of available fields;* TreeView replaced with TfrTreeView;- Localization of the FastCube toolbar fixed;   VCL.FastQueryBuilder [UI]+ First version of HiDPI added;   Lazarus.FastQueryBuilder [UI]+ First version of HiDPI added; VCL.FastScript [Engine]+ Support for XML and JSON added to FastScript;* Improvement of TfsTree by replacing TTreeView with TfrTreeView;- Fixed error in TfsScript.Destroy that could lead to a crash;   FMX.FastScript [Engine]+Added support for Android;- Error fixed in TfsScript.Destroy that could lead to a crash;   Lazarus.FastScript [Engine]+ Added support for XML and JSON to FastScript;* Improvement of TfsTree by replacing TTreeView with TfrTreeView;- Fixed error in TfsScript.Destroy that could lead to a crash;- Fixed fs_ibx package for compilation in Lazarus;   VCL.FastReport [Preview]+ Fixed collapsing when Application.MainFormOnTaskbar = True; [Engine]+ Added the ability to configure watermarks for report pages;* Modified the RichView splitting mechanism, added minimum non-breakable part definition;- Fixed HTMLView with Page.EndlessHeight;- Fixed "Class not found" error when using the UseFileCache property with empty pages in the report;- Fixed frxDecompressStream function;- Fixed error with incorrect value in CopyName macros;- Fixed date and time export to XLSX;- Fixed splitting of the RichView component with an empty line at the end;- Fixed SVG boundaries updating;- Fixed loading order of 'hmtx' table in TTF fonts;- Fixed error where a renamed dataset did not change the default username;- Fixed error where the print dialog reset settings when moved to a secondary screen;- Fixed size of the signature for non-visual components;- Fixed HiDPI support for smartMemo;- Fixed behavior of the band with additional height;- Fixed memory access error when using external DBX connection;- Fixed error when printing a nested report with multiple columns on the page;- Fixed missing line break in CellData.Text;- Fixed Memo AutoWidth error with macros like TotalPages;- Fixed error where some table events were triggered twice;- Fixed baBottom when the object breaks across multiple pages and added support for smMaxHeight for static tables (only AllowSplit rows);- Fixed rounding height error in band breaks;- Fixed left coordinate of the subreport when moving to a new page;- Fixed AnyDAC packages in FastReport product so they automatically install on RAD Studio XE3 and older IDEs;- Fixed error when macros are updated at design time;- Fixed duplex selection mode;- Fixed baBottom and smMaxHeight behavior in the page footer;- Fix that clears the ParentForm singleton when the parent form is closed not from the report component; [Exports]+ Improved export of RTL text to PDF;+ Added export of external symbols;+ Added support for ZUGfERD 2.3 in PDF export;- Removed compiler warning;- Fixed export of long HTMLView;- Fixed generation of PDF/A metadata;- Fixed PDF using the ZUGFeRD standard;- Fixed incorrect input focus transition via Tab in export dialogs;- Fixed numerical format in XLS export filter;- Fixed character size in SVG and PDF exports;- Removed floating anchor for the docx table, replaced with an empty line; [Client-server]+ Added new dialog form controls: Date picker, DBComboBox, ListBox, CheckListBox, MaskEdit (without mask), Password edit, PageControl, GroupControl, Panel;+ Added the ability to use a custom HTTP header in client-server components;* Redesigned the dialog generation engine, supporting nested controls and the ability to extend with custom controls;* Updated exports for client-server components;- Fixed an error when working with parameters and dialogs; [Designer]+ Improved rendering and functionality of designer elements in VCL themes;+ Added context menu for watch list windows in the report designer;* Redesigned the "Design -> Options" window for small screen resolutions;* Redesigned the dialog editor in the report designer;- Fixed error in RichEditor with older versions of msftedit.dll;- Fixed dialog scaling (TfrxDialogPage);- Fixed TfrxLabel behavior when AutoSize = True;- Fixed TfrxDesigner.DefaultFont functionality with HiDPI;- Fixed TfrxDialogPage behavior on a secondary screen;- Fixed barcode editing behavior in the report designer via the object inspector;- Fixed code completion behavior in nested procedures and functions in scripts, as well as in scripts with string concatenation expressions;- Fixed tooltip behavior in the code window;- Fixed menu style for the report designer in RAD 12.2 at design time; [Other]+ Added the ability to override the search form;* Updated Romanian resources;- Fixed compilation of InvoiceDemo;- Fixed example of CustomScrollsDemo; [Report object]+ Added support for single-page TIFF in TfrxPictureView;+ Added object for RFID Tags (TfrxDeviceCommand);+ Implemented a list of displayed pages in a PDF document (Range) in TfrxPDFView;- Fixed compatibility with HTML Viewer;- Fixed barcode rendering when ((Rotation > 0) and (WideBarRatio > 2));- Fixed default font size for the top label of barcodes with HiDPI;- Fixed behavior of the HTMLView component when colgroup width overrides td tag width settings;- Fixed report generation with RFID;- Fixed incorrect clipping in RichView;- Fixed label for two-dimensional barcodes;- Fixed label for two-dimensional barcodes;- Fixed setting "Swiss QRCode" for QRCode barcode;   FMX.FastReport [Engine]- Fixed "Class not found" error when using the UseFileCache property with empty pages in the report;- Fixed rotating text transfer when exporting to PDF;- Fixed date and time export to XLSX; [Exports]- Removed compiler warning;- Fixed WordWrap in PDF export with simple text visualization; [Designer]- Fixed group header editor;   Lazarus.FastReport [Engine]+ Added the ability to configure watermarks for report pages;- Fixed HTMLView with Page.EndlessHeight;- Fixed "Class not found" error when using the UseFileCache property with empty pages in the report;- Fixed frxDecompressStream function;- Fixed error with incorrect value in CopyName macros;- Fixed date and time export to XLSX;- Fixed loading order of 'hmtx' table in TTF fonts;- Fixed error where a renamed dataset did not change the default username;- Fixed error that caused the print dialog to reset settings when moved to a secondary screen;- Fixed error when creating TfrxComboEdit for Lazarus;- Fixed size of the signature for non-visual components;- Fixed HiDPI support for smartMemo;- Fixed behavior of the band with additional height;- Fixed memory leak when exporting PDF in Linux;- Fixed error when macros are updated at design time;- Fixed duplex selection mode;- Fixed baBottom and smMaxHeight behavior in the page footer;- Fix that clears the ParentForm singleton when the parent form is closed not from the report component; [Exports]+ Improved export of RTL text to PDF;+ Added export of external symbols;- Removed compiler warning;- Fixed export of long HTMLView;- Fixed generation of PDF/A metadata;- Fixed PDF using the ZUGFerd standard;- Fixed PDF export with HiDPI;- Fixed export dialogs with HiDPI;- Fixed image inversion in ZPL export; [Client-server]+ Added new dialog form controls: Date picker, DBComboBox, ListBox, CheckListBox, MaskEdit (without mask), Password edit, PageControl, GroupControl, Panel;+ Added the ability to use a custom HTTP header in client-server components;* Redesigned the dialog generation engine, supporting nested controls and the ability to extend with custom controls;* Updated exports for client-server components;- Fixed an error when working with parameters and dialogs; [Designer]- Fixed error in RichEditor with older versions of msftedit.dll;- Fixed dialog scaling (TfrxDialogPage);- Fixed TfrxLabel behavior when AutoSize = True;- Improved rendering and functionality of designer elements in VCL themes; [Other]+ Added the ability to override the search form; [Report object]+ Added object for RFID Tags (TfrxDeviceCommand);- Fixed behavior of the HTMLView component when the colgroup width overrides the settings for the "td" tag;- Fixed label for two-dimensional barcodes;- Fixed compatibility with HTML Viewer;- Fixed creation of composite barcodes; [Preview]- Fixed preview with HiDPI.  
Read
April 17, 2025

Importing documents from Word is already available in FastReport .NET Ultimate

With the release of 2025.2 subscribe to Ultimate .NET has become even a better deal! All license holders can get an additional plugin that allows you to import Microsoft Word documents (.docx). When you open such a file, it is converted into a report template FastReport .NET (.frx). The subscription price for Ultimate .NET has remained the same. Due to the large differences in formats, it is not always possible to fully match the two documents. However, this plugin allows you to significantly reduce the time needed to create a template based on an existing docx file. At the moment, our plugin does not support: highlighting the background of a part of the string, shapes, as well as nested vector graphics Vector Markup Language (VML) and OLE objects.  To start using this plugin in your business solution right now, update your license to version 2025.2 in your personal account. Then follow the instructions below to register the dll in FastReport, or connect the nuget package FastReport.Plugins.OOXMLImport. You can read about the import features and how to enable the plugin in the article. Read the article
Read

Articles

April 24, 2025

How to Open and Convert an FP3 File Using the FastConverter .FP3

FP3 is a format for ready-made reports generated using FastReport report generators, integrated into various business applications. A file in this format can be generated by different programs, such as CRM or ERP. To easily convert it to any preferred format, use the FastConverter .FP3. It allows you to convert .fp3 files to PDF formats versions 1.4, 1.5, 1.6, and 1.7, PDF/A (1, 2, 3), RTF, XLSX, XML, DOCX, TXT, CSV, PPTX, HTML, JPEG, BMP, PNG, TIFF, EMF, SVG, Open Document Format (ODT, ODS, ODP), and more. Both single file conversion and batch conversion are possible.     How to Convert a File from .fp3 to PDF Step 1: Install FastConverter .FP3. You need to download and install FastConverter .FP3 using this link. After installation, launch the program.   Step 2: Opening an FP3 file. Go to the "File" menu → "Open," then select an FP3 format file and click "Open."   Step 3: Converting FP3 to another format. After loading the file, click "File" → "Save As." A wide variety of supported formats for exporting the document will become available to you. In the "Target Format" field, select the desired format (PDF, DOCX, XLSX, HTML, PNG, etc.) from the list provided.   Step 4: Final file location and name. Specify the folder and file name for saving in the "Target File" field and click "Save." After the conversion is complete, the file will be available in the specified directory in the new format.   For any questions, please contact our support team at support@fast-report.com.
Read
April 22, 2025

Working with XML and JSON Formats in FastScript

Currently, XML and JSON formats have emerged as the primary standards for data storage and information exchange between computer systems. At the request of users, classes for handling XML and JSON have been added to FastScript. In this article, we’ll take a closer look at how to work with these classes, explore their properties and methods, and also create reports from code using scripts.     XML Format To work with XML in scripts, 2 classes are used. These classes are focused on maximum speed and low memory consumption.   TfrXMLDocument – a class that encapsulates the functionality of an XML document. The following properties and methods are available in it. Class Properties and Methods Description procedure SaveToStream(Stream: TStream); Saves the XML to the passed stream. procedure LoadFromStream(Stream: TStream; AllowPartialLoading: Boolean = False); Loads the XML from the passed stream. procedure SaveToFile(const FileName: string); Saves the XML to a file with the specified name. procedure LoadFromFile(const FileName: string); Loads the XML from a file with the specified name. procedure Clear; Deletes all XML nodes from the tree, except the root node. The content of the node is NOT cleared. property Root: TfrXMLItem; Allows access to the root element of the tree. property AsText: string; Allows you to both get and set the XML as a string (for example, using this property, you can pass the XML to the report script using a report variable). property AutoIndent: Boolean; Determines how the output XML will be generated: as a single line or as indented text.   TfrXMLNode – a class that encapsulates the properties of an XML document node. You cannot create an object of this type directly. It is created by calling the Add() method of the element to which you want to add a child element. Let’s take a closer look at the properties and methods of the TfrXMLNode class. Class Properties and Methods Description function Add(AName:string):TfrXMLItem; Creates a child TfrXMLItem with the specified name and returns it. procedure Clear; Clears the list of child elements. procedure InsertItem(Index:integer; AItem: TfrXMLItem); Inserts a child element into the specified position. The element may belong to another document. function Find(AName:string):Integer; Searches the child elements for a TfrXMLItem with the specified name and returns it. If the element is not found, -1 is returned. If there are several elements with the specified name, the first one is returned. function FindItem(AName:string):TfrXMLItem; Searches the child elements for a TfrXMLItem with the specified name and returns it. If the element is not found, a new element with the specified name is created and returned. If there are several elements with the specified name, the first one is returned. function Root: TfrXMLItem; Returns the root element of the document. property Count:Integer; Returns the number of child nodes of the element. property Items[AIndex:Integer]: TfrXMLItem; Returns a child element by its index. property Prop[AName:string]:string; Returns or sets the value of the node’s attribute with the specified name. property Name: string; The tag name of the element. property Parent: TfrXMLItem; The name of the parent element. Root is nil. property Text:string; A string containing a list of node parameters in the format Name1="Value1" Name2="Value2"… Special characters in this string are quoted. procedure Delete(AIndex: Integer); Deletes a child element with AIndex. procedure DeleteProp(const APropName: string); Deletes the node’s attribute with the specified name. property Value: string; The text that is located between the opening and closing tag of the element. function PropExists(APropName:string):Boolean; Helps to determine whether an element has an attribute with the specified name. function IndexOf(AItem: TfrXMLItem):Integer; Returns the index of the passed element. function GetPropNames(ANames:TStrings); Fills the passed list of strings with the names of the TfrXMLItem attributes.   Let’s try to build a report using classes for working with XML. For example, we will display data from the "country.xml" file in the report, but we will not use TClientDataSet, and will use direct access to the XML file. We create a new report, go to the editing mode, put MasterData on the report. And add several Memo on top to display the data. We will also create an OnBeforePrint event for the MasterData object. The final report script code will look like this: var doc: TfrXMLDocument; item: TfrXMLItem; IIndex: Integer;   procedure MasterData1OnBeforePrint(Sender: TfrxComponent); var cur: TfrXMLItem; S: string; begin cur := item[IIndex]; mmNum.Text := cur.Prop['Code']; mmName.Text := cur.Prop['Name']; mmCapital.Text := cur.Prop['Capital']; mmArea.Text := cur.Prop['Area']; mmPopulation.Text := cur.Prop['Population']; mmContinent.Text := cur.Prop['Continent']; Inc(IIndex); end;   begin Doc := TfrXMLDocument.Create; Doc.LoadFromFile('..\..\Data\country.xml'); item := Doc.Root[1]; IIndex := 0; MasterData1.RowCount := item.count; end. Let’s go ahead and run the report. To make it easier to read, we’ve also added column headers.     JSON Format Let’s smoothly transition from XML to JSON format. To work with it in FastReport, 2 classes are also used—TfrJSON and TfrJSONArray. In this case, these classes are simply a wrapper around classes from System.JSON in the Delphi platform or similar classes in Lazarus.   TfrJSONObject — a class that encapsulates functions for working with JSON objects. Class Properties and Methods Description function Create(const JSONstring: string); Creates a JSON object and populates it from the provided string. function IsValid:Boolean; Returns True if the object contains valid JSON. procedure LodFromFile(const AFilName:string); Loads data from the specified file. If the object contains data, it will be lost. procedure LoadFromtStream(const AStream:TStream); Loads data from the provided stream. If the object contains data, it will be lost. function ToString:string;   Returns a string containing the textual representation of the JSON object. procedure SaveToFile(const AFileName: string); Saves the textual representation of the JSON object to a file. procedure SaveToStream(AStream: TStream Saves the textual representation of the JSON object to a stream. function IsNameExists(const AName:string); Returns True if the object has a property with the specified name. function IsNameValueExists(const Name, Value: string): boolean; Returns True if the object has a property with the specified name and its value matches the specified value. function Count:Integer; Returns the total number of properties in the JSON object. property Names[AIndex:Integer]:string; Returns the name of the property at the specified index. Property ValueType[IndexOrName:Variant]:TfrJSONType; Returns the type of the property at the specified index or name. The type can be one of the following values:- jsUnknown–—The type of the property is unknown (a parsing error occurred or a property with such an index or name is missing). - jsNumber—The property has a numeric type. - jsString—The property has a string type. - jsBoolean—The property has a boolean type (true/false). - jsNull—The type of the property is null (no value is assigned). - jsList—The type of the property is a JSON array. - jsObject—The type of the property is a nested JSON object. The properties below allow you to retrieve the values of the JSON object in one form or another. In all these properties, indexing is performed either by the property number in the list of properties or by its name. Note that AsString[‘1’] <> AsString[1]. Also, if you try to get the value of a property using an inappropriate method, errors may occur and incorrect property values may be returned. For example, if a property has the type "Object" or "Array", then when you try to get its value using the AsString property, you will get an empty string. In other cases, AsString will return the string representation of the property’s value. Class Properties and Methods Description property AsObject[IndexOrName: Variant]: TfrxJSON; Allows you to retrieve a nested JSON object. property AsArray[IndexOrName: Variant]: TfrJSONArray; Allows you to retrieve a nested JSON array. Property AsString[IndexOrName: Variant]: string; Allows you to retrieve the value of a property as a string. This retrieval method can be applied to properties of other types, except for objects and arrays. For boolean values, a string containing the value "True" or "False" will be returned. For numbers with a fractional part, a dot will always be used as the fractional part separator, regardless of regional settings. property AsNumber[IndexOrName: Variant]: Extended; Allows you to retrieve the value of a property as a number. If the property has a non-numeric type, 0 will be returned. property AsBoolean[IndexOrName: Variant]: Boolean; Allows you to retrieve the value of a property as a boolean value. If the property has another type, False will be returned. To return a field of type null, you’ll have to put in a little effort. There isn’t a dedicated method for that. However, you can use the ValueType property, which returns jsNull for a field of type null, or use the AsString property, which returns the string ‘null’. Let’s take a closer look at the methods for manipulating object properties. Class Methods Description Procedure Delete(AName: String);   Removes a property with the specified name from the object. function AddObject(const AName: string): Integer Adds a child empty object with the specified name to the object. function AddArray(const AName: string): Integer; Adds an empty array with the specified name to the object. function AddString(const AName, AValue: string): Integer; Adds a string with the specified name to the object. function AddBool(const AName: string; AValue: boolean): Integer; Adds a boolean value with the specified name to the object. function AddNumber(const AName: string; AValue:Extended): Integer; Adds a numeric real value with the specified name to the object. function AddInteger(const AName: string; AValue:Integer): Integer; Adds a numeric integer value with the specified name to the object. function AddNull(const AName: string): Integer; Adds a null value with the specified name to the object. The methods return an integer, which is the index of the added element in the list of all fields. All methods that add fields to the object do not control the presence of existing fields with the same names. This procedure is the responsibility of the programmer using this class. Such control is necessary to prevent the appearance of multiple fields with the same names in the output JSON. The behavior of the system in this case is undefined—it depends on the parser that will further parse the received JSON. This means that any of the values with the same names may be used! The TJSONArray class encapsulates methods and properties for working with JSON arrays. In principle, the main properties are the same, but you can only access them by index. Only operations to access any element, get its value, or delete any element are supported. You cannot move elements in the array or change their type. Let’s consider the properties and methods for obtaining the values of elements in this class. Class Properties and Methods Description function Count:Integer; Returns the number of elements in the array. property ValueType[AIndex: Integer]: TfrJSONType; Returns the type of the array element with the specified index. property AsObject[AIndex: Integer]: TfrJSONObject; Returns an object providing access to the array element as a JSON object. Property AsArray[AIndex: Integer]: TfrJSONArray Returns an object providing access to the array element as a JSON array. property AsString[AIndex: Integer]: string; Returns the value of the array element as a string. property AsNumber[AIndex: Integer]: Extended; Returns the value of the array element as a number. property AsBoolean[AIndex: Integer]: Boolean; Returns the value of the array element as a boolean value. When dealing with arrays, like with objects, you need to carefully approach extracting the values of elements. Depending on the type of the value, you should use the appropriate method to retrieve it. The methods for manipulating elements of a JSON array are described below. Class Properties and Methods Description procedure Delete(AIndex:Integer); Deletes an array element at the specified index. function AddObject: Integer; Adds a nested JSON object to the end of the array. function AddArray: Integer; Adds a nested JSON array to the end of the array. function AddString(const AValue: string): Integer; Adds a string to the end of the array. function AddBool(AValue: boolean): Integer; Adds a boolean value to the end of the array. function AddNumber(AValue:Extended): Integer; Adds a floating-point number to the end of the array. function AddInteger(AValue: Integer): Integer; Adds an integer to the end of the array. function AddNull: Integer; Adds null to the end of the array. All of these methods return the position of the element added to the array. You cannot insert an element into the middle of the array; this is a limitation of the base classes in System.JSON.     Specifics of Using Classes to Access JSON When using objects, it’s important to remember that after using wrapper objects, you must remove all of them from the code. Note that if you want to get a child object or array, but instead there’s a scalar value or no value at all, the property will return nil, and an exception will occur when accessing that property further. Avoid using methods that are not intended to work with values of specific types stored in an element to retrieve those values. It’s important to note that property names of objects are case-sensitive, meaning "Item1" and "item1" are considered different names! You can only set values for object elements if the type of those values matches the type that is defined for the element. If you need to redefine the type of an element, delete it and add a new one with the same name and the type you want. Entering new values for array elements is not possible. You need to delete the JSON array and then recreate it with the values you want. Let’s use the classes from the description above and write a script that extracts data (without type information) from an XML file and puts it into a JSON object. procedure XMLToJSON; var XML: TfrXMLDocument; xi, xi1: TfrXMLItem; I, J: Integer; JO: TfrJSONObject; JA, JA1: TfrJSONArray; SL: TStringList; begin XML:=TfrXMLDocument.Create; XML.LoadFromFile('.\..\..\data\country.xml'); JO:=TfrJSONObject.Create('{}'); JO.AddArray('data'); JA:=JO.AsArray['data']; xi:=X.Root[1]; xi1:=xi.Items[0]; SL:=TStringList.Create; xi1.GetParamNames(SL); for I:=0 to xi.Count - 1 do begin xi1:=xi.Items[I]; JA1:=JA.AsArray[JA.AddArray]; for J:=0 to SL.Count-1 do JA1.AddString(xi1.Prop[SL[J]]); JA1.Free; end; JA.Free; JO.SaveToFile('.\..\..\data\country.json'); JO.Free; SL.Free; end; And let’s try to build a report based on the obtained data (first, place the appropriate MasterData and Memo components on the report page): var J:TfrJSONObject; A:TfrJSONArray; curr:Integer;   procedure MasterData1OnBeforePrint(Sender: TfrxComponent); var A1:TfrJSONArray; begin A1:=A.AsArray(curr); Memo1.Memo.Text:=A1.AsString[0]; Memo2.Memo.Text:=A1.AsString[1]; Memo3.Memo.Text:=A1.AsString[2]; Memo4.Memo.Text:=A1.AsString[3]; Memo5.Memo.Text:=A1.AsString[4]; Memo6.Memo.Text:=A1.AsString[5]; A1.Free; curr := curr + 1; end;   begin J:=TfrJSONObject.Create(''); J.LoadFromFile('.\..\..\data\country.json'); A:=J.AsArray[0]; MasterData1.RowCount:=A.Count; curr:=0; end.   You can also use these objects in Delphi code—simply include the frXML and frJSON modules in the uses statement.     Conclusion In this article, we explored the use of classes for working with JSON and XML in FastReport. If you’re a developer working not just with reports but also with Delphi and Lazarus, utilizing these classes will help minimize issues when switching between environments—your experience will be consistent across both IDEs. For your convenience, we’ve included two examples in this article demonstrating report generation using XML and JSON. You can open and run these examples directly in FastReportDemo, which comes with the FastReport distribution. You might need to configure the reports before running them—just make sure to specify the correct path to the data file "country.xml," which can be found both in the DemoCenter and in the folder with the examples. Download Examples
Read

Popular questions

What is a report generator?

Why do we need report generators and OLAP analytics tools?

What does Fast Reports Inc. do?

We are trusted

Fast Reports
  • 800-985-8986 (English, US)
  • +31 97 01025-8466 (English, EU)
  • +49 30 56837-3928 (German, DE)
  • +55 19 98147-8148 (Portuguese, BR)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2025 Fast Reports Inc.