SSRS Export to Excel Hide/Unhide Issue

我与影子孤独终老i 提交于 2019-12-21 20:29:26

问题


I have an SSRS 2008 report where in I have to hide some columns & export to excel and after exporting to excel, the requirement says that the columns should be unhidden in the excel. Please suggest a way to do this as I heard this can't be dont at all.

Thanks in advance!!


回答1:


It can be done, but I believe only when deployed to a SSRS 2008 R2 Server. That is how I am using it now. The way you do it is you use a conditional "Hidden" property on the columns that is set to the following: EDIT: switched the true false around so that it is not hidden in Excel

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

That will effectively hide the column unless it is outputting in Excel.

You access the columns if you are using VS2008 by selecting advanced mode on the top right drop down of the group explorer near the bottom of the interface. The columns will list top to bottom representing left to right representation of the columns. Set the "Hidden" property with one of those selected.




回答2:


It is possible! :)

You just have to select the columns that you want to hide in excel, go to the properties panel (you can press F4) and at the bottom, inside visibility, write this expression in the Hidden option:

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

Even if Visual Studio underlines the 'name' attribute in red, it works fine!

You can hide everything that you want in Excel, but it has to be rendered first in the RPL. Actually, when you hide it, it just appears like a white column.




回答3:


If Excel 2012 is used , then please try this instead

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



回答4:


The formula below worked fine for this scenario - I want page breaks in report viewer, but while exporting I need all the rows data in single excel sheet.

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



回答5:


No it can't.

Columns (or any data region) in SSRS that is not visible isn't rendered. It can't show in Excel because it isn't there.

From a user perspective, if I export I'd expect to get what I see on screen.

You could have a URLAccess based report that

  • points back the same report
  • has a hidden parameter RenderAllForExcel (..&RenderAllForExcel=true)
  • renders direct to Excel (...&rs:Format=Excel&rs:Command=Render)


来源:https://stackoverflow.com/questions/6655371/ssrs-export-to-excel-hide-unhide-issue

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