The cell merging function provided by fastreport is to "suppress duplicate values". The function is really weak, so it is better not to use it. There are also many solutions on the Internet, but they are not satisfactory for use.
The following are two online solutions:
1. Write code in the report script. Solution: Merge cells.
2. Modify the source code to solve the problem: Merge cells.
At first, I used the two solutions in combination. the disadvantages of the 1st solutions were obvious. Sometimes I needed to write a lot of code, so I was not careful and prone to errors. There were also problems with the 2nd solutions, it seems that only the first page is handled. When there are multiple pages, it will be messy.
Since I have used the fastreport report control for multiple software, over time, more and more reports have been generated, and the design of reports has brought a lot of work, which is really tolerable. At the beginning of the year, I started to study the source code of fastreport, and finally developed my own solution.
Solution Principle:
1. Create your own data structure to save the content, height, row number, and column number of all cells;
2. Two reports are used. The content and height of each cell are recorded for the first time. Before the Second Report, the height of the cells to be merged and merged is calculated in the data structure;
3. During the second process, set the height of the corresponding cell, set the height of the first merged cell to the height of the merged cell, and set the height of other merged cells to not be displayed;
Only frxclass. PAS and frxengine. Pas units are modified for the source code. The modified code is not much. In addition, a new frxmergecell. Pas unit is added to build its own data structure.
There are two ways to merge cells in this newspaper table:
1st types: The left cell is the parent cell, and only the parent cell is merged at the same time;
2nd types: irrelevant to the left cell, and merged as long as they are the same.
Provide relevant source code for paid use. If necessary, contact QQ: 258322672. The price is not very high. It takes some time to modify this item. If you have purchased it, no matter whether it is related to the source code or not, you will try your best to provide anything you know. The fastreport4. * series is supported. Whether the fastreport3. * series is not tested.
Format 1 report:
Format 2 report:
Fastreport cell merge