Skip to main content

Spreadsheet Report Designer Control

  • 4 minutes to read

The ExpressSpreadSheet Report Designer Control (the Report Designer control, for short) implemented as the TdxSpreadSheetReportDesigner component is designed to create spreadsheet document-based templates and build simple and master-detail tabular reports from one or more bound data sources. The Report Designer is a data-aware Spreadsheet control version that hosts a report template including at least one section with placeholder fields corresponding to the bound dataset’s fields, and therefore, the actual field values in resulting reports.

The Report Designer control can replace the source template with a built report document or show it in a separate Spreadsheet or Report Designer control, depending on the destination passed as the Build procedure’s parameter. The procedure always excludes all cells outside the report section boundaries from the resulting report document:

A simple report template (as in the previous case) always includes the detail section with placeholder fields corresponding to the bound dataset’s fields, and optionally, the header and/or footer sections that include inscriptions identical for all reports (such as column captions and a company’s logo, for example). In addition to these sections, master-detail report templates include at least one nested detail section:

A section within a report template can include simple and formatted cell values, formula expressions, comments and floating containers like any other spreadsheet document. In addition, report sections can have special placeholder fields that correspond to the stored dataset fields obtained from one (in the case of a simple report) or more (for master-detail reports) datasets bound to the Report Designer control via the DataBinding property. All these placeholders are cells with formula expressions that include special report template functions, usable like any other registered function.

The Report Designer provides the Field Chooser that shows a tree-like structure populated with fields from one or more bound datasets. End users can drag-and-drop these fields to cells within report template sections to create placeholder cells. The corresponding report template formula expressions are created automatically.

You can either invoke this UI element as a separate floating form or host it within a specific control (the TcxGroupBox control, for example) by assigning it to the Field Chooser’s Site property.

Once the report template is ready, call the Report Designer’s Build procedure passing the target Spreadsheet control as a parameter. Depending on the Report Designer’s Options.ReportMode property value, the procedure can build grouped and/or multi-level reports on multiple worksheets, or separate documents (if you provide additional target controls as report destinations within the OnNewDocument event handler.

The following table lists the Report Designer-specific class members that complement the core spreadsheet functionality that the TdxSpreadSheet control provides:

Contents

The DataBinding.DataSource and DataBinding.Details properties can be used for binding the master and optionally, detail data sources.

The DataBinding.DataGroups and DataBinding.SortedFields properties allow you to group and sort dataset records in the resulting report. Each detail dataset link, if present, provides the DataGroups and SortedFields for grouping and sorting records obtained from a dataset bound by using the DataSource property.

The SetHeaderSection, SetFooterSection, SetDetailSection, SetGroupHeaderSection, SetGroupFooterSection, and RemoveSection methods are used to manage report template sections.

Appearance

With the Options.DesignView property you can show or hide auxiliary visual elements on the displayed report template.

Behavior

The Options.Orientation and Options.ReportMode properties allow you to customize how the resulting report is built. Call the Build procedure to build or rebuild a report.

Additionally, the DataBinding.Options property set specifies how bound dataset field values are interpreted in the group and sort operations. An individual detail dataset link, if present, provides the similar Options property set for the same purpose.

With the FieldChooser.Show and FieldChooser.Hide procedures, you can switch the visibility of the Report Designer’s Field Chooser UI component. Use the FieldChooser.Site property to display the component within a TWinControl descendant.

See Also