简体   繁体   English

将 SSRS 报告导出到 excel 时禁用超链接

[英]Disable hyperlinks when exporting SSRS report to excel

I am using the ReportViewer control to render some local reports.我正在使用 ReportViewer 控件来呈现一些本地报告。 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).其中一些元素包含大量数据(作为 arguments 传递给子报表)。 The problem is when i export the report to excel, it wont open in excel because of the cell max character limit.问题是当我将报告导出到 excel 时,由于单元格最大字符限制,它不会在 excel 中打开。 I am wondering if its possible to disable/remove certain columns from this report when exporting to excel.我想知道在导出到 excel 时是否可以从此报告中禁用/删除某些列。 I have tried to use the DeviceInfo setting and trying to disable formulas but that did not help much.我曾尝试使用 DeviceInfo 设置并尝试禁用公式,但这并没有太大帮助。

many thanks非常感谢

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 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请考虑这可能不适用于旧版本的 SSRS

Below is link where I detailed how I used this property to disable hyperlinks, when exporting report to SSRS.下面是我详细介绍了在将报告导出到 SSRS 时如何使用此属性禁用超链接的链接。

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

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?前段时间我问了一个类似的问题: Reporting Services 2008:有没有办法根据报表的呈现方式来更改项目属性?

(I wanted to disable some items when a report was rendered as a Word document). (当报表呈现为 Word 文档时,我想禁用某些项目)。

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) (见 Gerrie Schenck 对我的帖子的回答)

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好吧,我使用的是它的 winforms 版本,对此有两种可能的解决方案,一种是编写自己的渲染器(这对这个来说有点过头了),另一种是调整报告定义

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.我在 XmlDocument 中加载了报表定义并从中删除了所有操作节点,这将取出所有链接,然后在后台使用新定义重新运行报表并将其呈现给 excel。 Although it takes a little more, it does the job.虽然它需要更多的时间,但它完成了工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM