Search code examples
c#reporting-servicesreportviewermicrosoft-reporting

Column repeat direction in microsoft report viewer


I am using windows form to generate Identity Card using c# and Microsoft report viewer. Everything is working fine except I could not find column repeat direction in Microsoft report viewer.

Current Scenario

My report paper size is A4. Each page can display maximum 10 individual cards. There are 2 columns in page. Each column display 5 cards. It is generating card as shown in image. The column repeat direction is vertically. It first list 1st column (1-5) and then list 2nd column (6-10).

enter image description here

My Requirement

I want the report column repeat direction to be horizontally like in the image below. First display 1 then 2 and 3 and 4 and so on.

enter image description here

Why I want to display horizontally rather than vertically?

It will save the paper. For example, if the user generate 4 Identity cards only then as per current scenario, it will generate 4 cards in column 1 and the whole page space is wasted because I can not re-use the left space.

By repeating the column direction to horizontally, the 4 cards will be displayed as in column 1, card 1 and 3 and in column 2, card 2 and 4 will be displayed. I can then cut the paper and reuse it later.

I have searched alot but could not find any solution. Any suggestion, comments or links will be helpful. I can not use any other reports. Thanks in advance.


Solution

  • Create a matrix

    Define your row grouping as

    =Ceiling(Fields!CardNo.Value/2)
    

    Define your column grouping as

    =Fields!CardNo.Value Mod 2
    

    Your report design will look something like this. Outer group is just shown for illustration purposes but you can delete it.

    enter image description here

    Now when you run the report. You will get the result you are looking for

    enter image description here

    Without any grouping header and footer. Your report output will be

    enter image description here