0

I have an MVC application which displays reports based on the report viewer.

Currently, the report has 4 columns and the requirement is to show columns based on the parameters selected.

I had achieved the solution by using sending parameters to the rdlc file and hiding the columns.

But now the problem which I am having is, when the report is exported as excel the last hidden column is showing as an empty column and this is an issue when printing the report from excel.

I would like to know if there is anything that can be done through code so that the column is not generated at all instead of hiding it. had done a lot of research but didnt find any solution. Can anyone please help me... Thanks!!!

Rocky
  • 139
  • 12

1 Answers1

0

One option would be to update the column's cell expressions to not return anything unless the parameter is set to show that column:

=iif(Parameters!HideColumnValue,Nothing,Fields.YourFieldName.Value)

If your column has background or line formatting that needs to not show when the column his hidden, you can set that as well:

Background Color:

=iif(Parameters!HideColumnValue,"White","Gainsboro")

Lines:

=iif(Parameters!HideColumnValue,"None","Solid")
Ron Smith
  • 3,241
  • 1
  • 13
  • 16