Overview
Version
Report Server Version |
---|
11.0 |
Application Scenario
Parent/Child cells are concepts closely related to cell expansion. Cell expansion applies to one specific cell. If multiple cells are bound in the report body, are these cells related during expansion, and do the expansion directions of these cells affect each other?
Take the Region and Salesperson fields as an example. A hierarchical relationship exists between these two fields. That is to say, each region has multiple different salespersons. In this case, you want to show the hierarchical relationship between these two fields during cell expansion, that is, to display the values of these two fields by group. You can achieve this effect by the parent-child cell setting in FineReport.
In the following figure, the Region field is the parent cell, and the Salesperson field is the child cell. For details about specific setting methods, see section "Example."
Function Description
During report design in FineReport, the cell that is set as the parent cell of a selected cell is marked with a blue arrow.
FineReport supports two types of parent-child cell settings.
Left Parent Cell: If a vertical expansion relationship exists between cells, set the left parent cell.
Up Parent Cell: If a horizontal expansion relationship exists between cells, set the up parent cell.
Example
When you set the left/up parent cell of a child cell in the designer, three options (None, Default, and Custom) are available in the drop-down list.
The following uses how to set the left parent cell during vertical cell expansion as an example to specifically describe the application scenarios and effects of the three options for parent-child cell settings.
None
If you select None, no parent cell is set. That is to say, the grouping relationship between cells is not taken into consideration during cell expansion.
Select cell B2, choose Cell Attribute > Expansion on the right attribute panel, use the default setting (Vertical) of Expansion Direction, and set Left Parent Cell to None.
The following figure shows the report effect.
Default
When the left or up cell adjacent to a selected cell has an expansion attribute, the left cell is the left parent cell of the selected cell, or the up cell is the up parent cell of the selected cell by default.
If you select Default, the up cell (in which values are expanded horizontally) or left cell (in which values are expanded vertically) adjacent to the cell into which a data column is dragged is automatically used as the up parent cell or left parent cell.
1. The setting takes effect only for adjacent cells in the same row or column. For non-adjacent cells, you need to customize the setting.
2. When the left cell adjacent to a selected cell does not have the expansion attribute, the system will use the left or up cell that has the expansion attribute (searched in sequence) as the parent cell of the selected cell.
Select cell B2, choose Cell Attribute > Expansion on the right attribute panel, use the default setting (Vertical) of Expansion Direction, and set Left Parent Cell to Default. Because the values in A2 (left cell of B2) are vertically expanded, the default left parent cell of B2 is A2.
The following figure shows the report effect.
Custom
If cells between which an expansion relationship exists are not adjacent to each other, the default setting cannot be used. In this case, you can select Custom to set the parent-child relationship between them.
Cells A2 and B3 are not adjacent, but a vertical expansion relationship exists between them. Select cell B3, choose Cell Attribute > Expansion on the right attribute panel, use the default setting (Vertical) of Expansion Direction, set Left Parent Cell to Custom, and select A2.
The following figure shows the report effect.
Root Parent Cell
Another concept, root parent cell, is added as a supplement here, which may be involved in other documents.
Strictly speaking, a root parent cell can be a leftmost parent cell (for vertical expansion) or an upmost parent cell (for horizontal expansion).
The root parent cell does not refer to the cell at the far left or top, but the leftmost or upmost cell in terms of the parent-child relationship.
For example, in detailed table where data is vertically expanded, the left parent cell of A2 is B2, and the left parent cell of C2 is A2. In this case, B2 is the root parent cell (actually the leftmost parent cell).
The following figure shows the table preview effect.
The root parent cell has the following characters:
Child cells (in which values are expanded following the root parent cell) exist. That is to say, the root parent cell is set as the parent cell of these child cells.
The root parent cell itself does not have a parent cell. So the expansion of values in the root parent cell is not affected by other cells.