Report Generator FastReport .Net User Guide: Matrix-type Reports

FastReport .Net is a full-featured Windows Forms, ASP.NET and MVC report analysis solution. Using FastReport .NET, you can create application-independent .NET reports. At the same time, FastReport .Net supports 14 languages ​​including Chinese and English. This ensures your products are truly international.

FastReport.NET official version download (qun: 585577353) icon-default.png?t=N7T8https://www.evget.com/product/1861/download

 A "Matrix" object is a table, which, like the "Table" object, consists of rows, columns, and cells. At the same time, how many rows and columns there will be in the matrix is ​​not known in advance, it depends on the data to which the matrix is ​​connected.

The object looks like this:

fixed report

When printed, the matrix fills up with values ​​and grows up and down. The result is as follows:

fixed report

Matrix-type report basic theory

Let's take a look at the elements of matrix:

fixed report

In the picture, we see a matrix with 2 rows and 4 columns. Where a, b - row headers, 1, 2, 3, 4 - column headers, a1...a4, b1...b4 - cells. To generate such a report, you only need a data source with 3 columns containing the following data:

a 1 a1

a 2 a2

a3 a3

a 4 a4

b 1 b1

b 2 b2

b 3 b3

b 4 b4

As shown in the figure, the first column represents the matrix row, the second column represents the matrix column, and the third column represents the cell content at the intersection of the row and row, and is marked with numbers. When creating a report, FastReport creates a matrix in memory and populates it with data. During this process, the matrix is ​​dynamically increased if the row or column for a given number does not already exist.

A title can have multiple levels. Let's look at the following example:

fixed report

In this example, one column is a composite column, that is, it has two values. This report requires the following data:

a 10 1 a10.1

a 10 2 a10.2

a 20 1 a20.1

a 20 2 a20.2

b 10 1 b10.1

b 10 2 b10.2

b 20 1 b20.1

b 20 2 b20.2

Here, the first column represents the rows and the second and third columns represent the matrix columns. The last column of data contains the cell's value.

The next matrix elements are the subtotals and grand totals, which is demonstrated in the image below:

fixed report

This report is based on the same data used in the previous example. The rows shown in gray in the figure are automatically calculated.

Configure matrix

After placing the new "matrix" object on the worksheet, it will look like this:

fixed report

The matrix can be configured via the mouse. To do this, drag and drop data source columns from the Data window into the matrix, creating rows, columns, and cells. The matrix will be highlighted with a red border as the location for placing new data:

fixed report

If the matrix already contains some elements, an indicator will be displayed when new elements are placed. In this example, the new data will be placed between the "Year" and "Name" elements:

fixed report

You can also change the order of existing elements. To do this, click on the element's border (shown in black) and drag it to the desired position:

fixed report

To delete an element, select it with the mouse and press the "Delete" key.

Configure headers

To configure a title element, select the element and right-click to display its context menu:

fixed report

By default, the data in the matrix header is sorted in ascending order. You can change the sort order by selecting the "Sort" item.

Typically, each item in the matrix header has a total (which is a cell with the text "Total"). You can delete the total by selecting it and pressing the "Delete" key. To enable the total again, select the element to which it belongs and select the "Total" item in the right-click menu.

The "Start New Page" menu item causes the matrix to insert a page break after printing each header value. For example, if you enable page breaks for the "Year" item (as shown in the image above), each year value will print on its own page.

The "Suppress Totals" item suppresses totals if the group for which the total is being calculated contains only one value.

Configure cells

To configure a title element, select the element and right-click to display its context menu:

fixed report

By default, the data in the matrix header is sorted in ascending order. You can change the sort order by selecting the "Sort" item.

Typically, each item in the matrix header has a total (which is a cell with the text "Total"). You can delete the total by selecting it and pressing the "Delete" key. To enable the total again, select the element to which it belongs and select the "Total" item in the right-click menu.

The "Start New Page" menu item causes the matrix to insert a page break after printing each header value. For example, if you enable page breaks for the "Year" item (as shown in the image above), each year value will print on its own page.

The "Suppress Totals" item suppresses totals if the group for which the total is being calculated contains only one value.

matrix style

To change the appearance of matrix cells, click on the desired cell. With the toolbar, you can set fonts, borders, and padding. To change the appearance of multiple cells at once, select a group of cells. To do this, select the upper left cell and, without leaving the mouse, move the mouse to select the group of cells:

fixed report

You can use styles to change the appearance of the entire matrix. To do this, call the right-click menu of the "matrix" object and select a style:

Row and column size management

Since a "Matrix" object is a "Table" object, rows and columns can be sized in the same way.

By default, the matrix has "AutoSize" mode enabled. In this mode, the matrix automatically calculates column/row sizes. You can also manage the size of objects manually. To do this, disable the "AutoSize" property of the matrix. Rows and columns have the same property, which can also be used if the matrix's automatic sizing is disabled.

To limit the minimum and maximum width of a column, select a column and set its "MinWidth" and "MaxWidth" properties.

To limit the minimum and maximum height of a row, select a row and set its MinHeight and MaxHeight properties.

Guess you like

Origin blog.csdn.net/m0_67129275/article/details/132871279