Hide Column in SSRS

こ雲淡風輕ζ 提交于 2019-12-05 02:36:52

问题


I am using SSRS 2012, and Excel 2010, I want to hide a column when Exporting to Excel, after looking through some of the forums it seems the best way to do this is by going to the Column or Text box of what you are looking to hide and under the Visibility/Hidden option set the Expression to be :

=IIF(Globals!RenderFormat.Name = "EXCEL",true,false)

I have tried this and for some reason it doesn't work, however if I reverse the options of true and false I can get it to hide the column in SSRS but it also hides this in Excel. Could this be an issue because of the version of Excel I am using?


回答1:


In SSRS 2012 the XLSX export format was introduced, which uses a different renderer than XLS exports.

So I wonder if this is causing the issue. Modify the visibility statement to consider both export formats, something like:

=IIF(Globals!RenderFormat.Name = "EXCEL" or Globals!RenderFormat.Name = "EXCELOPENXML"
  ,true
  ,false)

This seems like a good first test.




回答2:


Because you are returning a boolean you do not need the IIF:

=Globals!RenderFormat.Name = "EXCEL" or Globals!RenderFormat.Name = "EXCELOPENXML"

or this is also valid:

=InStr(Globals!RenderFormat.Name,"EXCEL") > 0


来源:https://stackoverflow.com/questions/16334886/hide-column-in-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!