2
votes

I am using the ReportViewer control to render some local reports. These reports have some elements that are links to supreports. Some of these elements contain a lot of data ( to be passed as arguments to subreport). The problem is when i export the report to excel, it wont open in excel because of the cell max character limit. I am wondering if its possible to disable/remove certain columns from this report when exporting to excel. I have tried to use the DeviceInfo setting and trying to disable formulas but that did not help much.

many thanks

3

3 Answers

7
votes

Although this link is very old, I am adding this answer as it might help someone else coming here (like I came a few days back ;)

Below is property that tells type in which report is rendered.

Globals!RenderFormat.Name

This property can be used to conditionally set action on textbox, or setting visibility of column as I did.

Please consider that this might not work for older versions of SSRS

Below is link where I detailed how I used this property to disable hyperlinks, when exporting report to SSRS.

http://www.technicalsmile.blogspot.in/2012/10/disable-hyperlinksjavascript-when.html Thanks

3
votes

I asked a similar question a while ago: Reporting Services 2008: Is there a way to change item properties, depending on how a report is being rendered?

(I wanted to disable some items when a report was rendered as a Word document).

Unfortunately there is no really simple answer, but if you're willing to spend some time on it some custom code should do the trick. (See Gerrie Schenck's answer to my post)

2
votes

well i was using the winforms version of it, and there 2 possible solutions to this, one is to write your own renderer ( which was a overkill for this), and the other was to tweak the report definition

I loaded the report definition in an XmlDocument and removed all Action nodes from it, this would take out all the links, and then re ran the report with the new definition in the background and render it to excel. Although it takes a little more, it does the job.