Click here to Skip to main content
15,071,399 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
I am developing a report (RDLC) using Microsoft ReportViewer in local mode. It is a matrix report (some may call this a crosstab report). For example, the matrix table may have 3 columns for populations of cities:

-----------------------------------
State city Population
-----------------------------------
TX Houston 3000000
TX Dallas 1500000
CA Los Angeles 3500000
CA San Francisco 2500000
-----------------------------------

However, ReportViewer groups multiple values of states into one merged cell like so:

-----------------------------------
State city Population
-----------------------------------
TX Houston 3000000
Dallas 1500000
CA Los Angeles 3500000
San Francisco 2500000
-----------------------------------

When exported to Excel, the cells in Excel are also merged. Is there a way not to have the first column merged? The format of the table on the top is what I want, not the bottom one.

I am using VS 2010 SP1, VB, .NET Framework 3.5 SP1.
Hope someone can have a solution, or can tell me that this is a current limitation.

Thanks in advance.
Posted
Updated 12-Jun-11 8:46am
v6

I had a similar problem. This might not be the best solution but it solves the issue.

Include an extra column in your data (Call it what you like) you can even leave it blank.

When you create the matrix group on State as you are doing and also include the extra column so that it shows between state and city.

In design view populate the blank column with State value.

Make the State column invisible.

That gives you the format in your first table.

I hope this helps.
   
Comments
Member 7939131 14-Jun-11 20:30pm
   
Yes it is a good work around. I think this is a 98% solution. 1% is that the invisible column, while not exported to PDF, but is exported to Excel. The other 1% is that if the user selects a big data range, there is this extra column of data the report needs to handle, so the performance may get a little hit.

But this is good enough for me, and I hope for my users. I've already released the update.

Lots of thanks for your help.
Muhammad Ali Shahzeb 9-Apr-14 4:40am
   
Thanks for the tip. It worked :)
A little late to the punch, but this question appeared high on the Google results.

If you right-click on a group in the Grouping Window, and choose Group Properties, it opens a Group Properties window. In that window you can add additional fields to group by. You can then add static columns for those fields into the Tablix.

In the RDLC file, this looks like:
HTML
<TablixRowHierarchy>
  <TablixMembers>
    <TablixMember>
      <Group Name="Level_Block_Name">
        <GroupExpressions>
          <GroupExpression>=Fields!Level.Value</GroupExpression>
          <GroupExpression>=Fields!Block.Value</GroupExpression>
          <GroupExpression>=Fields!Name.Value</GroupExpression>
        </GroupExpressions>
      </Group>
      <SortExpressions>
        <SortExpression>
          <Value>=Fields!Level.Value</Value>
        </SortExpression>
        <SortExpression>
          <Value>=Fields!Block.Value</Value>
        </SortExpression>
        <SortExpression>
          <Value>=Fields!Name.Value</Value>
        </SortExpression>
      </SortExpressions>
      ...
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900