RDLC tables - merging cells vertically and horizontally

34,467

Solution 1

I found a solution on this page

By the default, a single row header is created when adding a grouping or field in a Tablix. In order to merge two cells of two rows in a column, try the following steps:

Note: The following will only work if the "Row Header was generated by adding a parent or child group". If this was just dragged from a dataset, you will never see the merged cell option.

  1. Insert a row above the single row header (again this is grouping header). The original header at this point will be in the second row.
  2. Select the adjacent cells vertically (e.g. two cells of two rows in a column) by using pressing Ctrl key and Clicking on the Cell. The selection should be highlighted by a dark grey thick border around the edges.
  3. Right-Click on your selection in the whitespace area, you should "Merge Cells" in the popup menu. Select "Merge Cells".
  4. The two adjacent vertical cells are merged at this stage. You need to write label text again as the merging will erase it. To center the text, you can just press enter first and normally it will center.
  5. Do this to the other columns that you need to merge.

Solution 2

To achive this veritcle merging need two Tablix .

In fact we use multiple Tablix to drag and drop what we need.

For acheive this you need adjust size of the cells to get perfect shape.

Look two simple steps how we did this.

Note: Main Tablix dataset is supplied to inside Tablix

See example image:This this image after[![This is the image before]2

Solution 3

Below is how to achieve what you want.

I assume that the data table which contains data to be printed in above layout has 7 columns viz image, value1, value2, value3 and text1, text2, text3. That means, each row of data table has 7 fields.

Now, the Tablix is to be designed in such a way that it produces the desired layout which you can do as under:

  1. Add a tablix control to rdlc. By default it shows one header row, one detail row, one footer row and three columns. Remove one column, header row and footer row; resulting in one detail row with two columns.
  2. Add two detail rows so that there are total of three detail rows and two columns; thus, six cells
  3. For ease, I refer to each as cell as A1, B1, A2, B2, A3, B3 (excel like notation)
  4. Set height of each row as required
  5. Set width of each column as required
  6. Specify data table for the tablix
  7. Add image control to cell A1
  8. Add Rectangle control (Rectagle1) to cell A2 and resize it to fill the entire A2 area
  9. Add Textbox control (Textbox1) inside Rectagle1; set size and location of Textbox1
  10. Add another Textbox control (Textbox2) inside Rectagle1; set size and location of Textbox2
  11. Merge A2 and B2 cells to span across the full tablix width
  12. Add Rectangle control (Rectangle2) to above merged cell
  13. Add Textbox control (Textbox3) inside Rectangle2; set size and location of Textbox3
  14. Add Textbox control (Textbox4) inside Rectangle2; set size and location of Textbox4
  15. Add Textbox control (Textbox5) inside Rectangle2; set size and location of Textbox5

Now, the required layout is ready; rest of the things you can complete in my opinion.

Share:
34,467
Scott
Author by

Scott

Updated on December 15, 2021

Comments

  • Scott
    Scott over 2 years

    I am working on a new RDLC report (as part of a WinForms application) and I need to have the report take a simple table (6 columns of simple data), and for each row in the table, display a box that contains that data, but arranged such that the first two "rows" in that box consist of first an image (two "cells" merged vertically) and then two values (above each other - each on their own "row"). Then it needs to include 3 values (as separate "rows" as wide as the entire box (i.e. merging the two cells horizontally)

    And it needs to repeat that entire box for every row of data.

    How can I accomplish this, given that it includes both horizontal and vertical merging of cells (and I'm not sure how to do that in either a table or matrix in the RDLC)?

    Here is a mock-up of this, to better show what I need:

    Mock-Up