问题描述
我正在使用 SSRS 2012 和 Excel 2010,我想在导出到 Excel 时隐藏一列,在浏览了一些论坛后,似乎最好的方法是转到列或文本框您要隐藏并在可见性/隐藏选项下将表达式设置为:
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)
我已经尝试过这个,但由于某种原因它不起作用,但是如果我反转 true 和 false 的选项,我可以让它在 SSRS 中隐藏该列,但它也会在 Excel 中隐藏它.这可能是我使用的 Excel 版本的问题吗?
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?
推荐答案
在 SSRS 2012 中引入了 XLSX 导出格式,它使用与 XLS 导出不同的渲染器.
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.
这篇关于在 SSRS 中隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!