<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Disabling Export Formats in Reporting Services</title>
	<atom:link href="http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/</link>
	<description>agile thinking</description>
	<lastBuildDate>Mon, 09 Jan 2012 21:29:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rup</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-77487</link>
		<dc:creator>Rup</dc:creator>
		<pubDate>Mon, 09 Jan 2012 21:29:57 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-77487</guid>
		<description>is it possible to add close button or close option on Report Viewer bar.</description>
		<content:encoded><![CDATA[<p>is it possible to add close button or close option on Report Viewer bar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: whizkidguys</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-56537</link>
		<dc:creator>whizkidguys</dc:creator>
		<pubDate>Fri, 03 Jun 2011 11:10:17 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-56537</guid>
		<description>I&#039;ve tried by adding your method DisableUnwantedExportFormats() for hiding Export to Excel option. When report loaded first time the excel option not getting visible.

However, When I used to call the same method inside of Drillthrough() event &quot;Excel&quot; &amp; PDF option getting visible in Export controls dropdown. I&#039;ve tried by calling your method in the first statement of my Drillthrough() event,(like what I used in Page load method).

Please let me know, How can I hide the excel option in Drillthrough() event of Reportviewer.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve tried by adding your method DisableUnwantedExportFormats() for hiding Export to Excel option. When report loaded first time the excel option not getting visible.</p>
<p>However, When I used to call the same method inside of Drillthrough() event &#8220;Excel&#8221; &amp; PDF option getting visible in Export controls dropdown. I&#8217;ve tried by calling your method in the first statement of my Drillthrough() event,(like what I used in Page load method).</p>
<p>Please let me know, How can I hide the excel option in Drillthrough() event of Reportviewer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sipho</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-50590</link>
		<dc:creator>sipho</dc:creator>
		<pubDate>Thu, 03 Mar 2011 06:41:39 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-50590</guid>
		<description>Thanks, it really helped me as well. It was easy to implement.</description>
		<content:encoded><![CDATA[<p>Thanks, it really helped me as well. It was easy to implement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chenman</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-49274</link>
		<dc:creator>chenman</dc:creator>
		<pubDate>Thu, 17 Feb 2011 15:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-49274</guid>
		<description>Thanks you all for this wonderful solution. I had the similar issue as Chad. We have Reporting Services 2008, SQL SERVER 2008 R2, so Chad&#039;s solution worked out great for me.
Chad: I have a quick question, what was the change that you made to your web.config (formats to disable).</description>
		<content:encoded><![CDATA[<p>Thanks you all for this wonderful solution. I had the similar issue as Chad. We have Reporting Services 2008, SQL SERVER 2008 R2, so Chad&#8217;s solution worked out great for me.<br />
Chad: I have a quick question, what was the change that you made to your web.config (formats to disable).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hellbinder</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-39626</link>
		<dc:creator>hellbinder</dc:creator>
		<pubDate>Thu, 09 Sep 2010 20:50:50 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-39626</guid>
		<description>I love you! This is what I needed for at least plan B. I am actually trying to check if the report exceeds the 256 column, is that possible? Because I want to disable the export option if it does exceed the column count of 256.</description>
		<content:encoded><![CDATA[<p>I love you! This is what I needed for at least plan B. I am actually trying to check if the report exceeds the 256 column, is that possible? Because I want to disable the export option if it does exceed the column count of 256.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-28847</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Mon, 28 Dec 2009 21:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-28847</guid>
		<description>I am working for a company that has Reporting Services 2008, SQL SERVER 2008 and develops with VB.  Here is the converted VB code.

Public Class ServerReportDecorator
        Private ReadOnly serverReport As ServerReport

        Public Sub New(ByVal reportViewer As ReportViewer)
            Me.serverReport = reportViewer.ServerReport
        End Sub

        Public Sub New(ByVal serverReport As ServerReport)
            Me.serverReport = serverReport
        End Sub

        Public Sub DisableUnwantedExportFormats()
            For Each extension As RenderingExtension In serverReport.ListRenderingExtensions()
                If extension.Name = &quot;XML&quot; Or extension.Name = &quot;IMAGE&quot; Or extension.Name = &quot;MHTML&quot; Or extension.Name = &quot;EXCEL&quot; Or extension.Name = &quot;WORD&quot; Then
                    ReflectivelySetVisibilityFalse(extension)
                End If
            Next
        End Sub

        Private Sub ReflectivelySetVisibilityFalse(ByVal extension As RenderingExtension)
            Dim info As FieldInfo = extension.GetType().GetField(&quot;m_isVisible&quot;, BindingFlags.NonPublic Or BindingFlags.Instance)

            If Not info Is Nothing Then
                info.SetValue(extension, False)
            End If
        End Sub
    End Class</description>
		<content:encoded><![CDATA[<p>I am working for a company that has Reporting Services 2008, SQL SERVER 2008 and develops with VB.  Here is the converted VB code.</p>
<p>Public Class ServerReportDecorator<br />
        Private ReadOnly serverReport As ServerReport</p>
<p>        Public Sub New(ByVal reportViewer As ReportViewer)<br />
            Me.serverReport = reportViewer.ServerReport<br />
        End Sub</p>
<p>        Public Sub New(ByVal serverReport As ServerReport)<br />
            Me.serverReport = serverReport<br />
        End Sub</p>
<p>        Public Sub DisableUnwantedExportFormats()<br />
            For Each extension As RenderingExtension In serverReport.ListRenderingExtensions()<br />
                If extension.Name = &#8220;XML&#8221; Or extension.Name = &#8220;IMAGE&#8221; Or extension.Name = &#8220;MHTML&#8221; Or extension.Name = &#8220;EXCEL&#8221; Or extension.Name = &#8220;WORD&#8221; Then<br />
                    ReflectivelySetVisibilityFalse(extension)<br />
                End If<br />
            Next<br />
        End Sub</p>
<p>        Private Sub ReflectivelySetVisibilityFalse(ByVal extension As RenderingExtension)<br />
            Dim info As FieldInfo = extension.GetType().GetField(&#8220;m_isVisible&#8221;, BindingFlags.NonPublic Or BindingFlags.Instance)</p>
<p>            If Not info Is Nothing Then<br />
                info.SetValue(extension, False)<br />
            End If<br />
        End Sub<br />
    End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Kostecki</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-26420</link>
		<dc:creator>Rob Kostecki</dc:creator>
		<pubDate>Wed, 11 Nov 2009 20:09:03 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-26420</guid>
		<description>I stumbled across similar challenge today using VS 2008 and SQL 2005 (9.00.4035.00). I found out that the “m_serverExtension” actually does not exists nor “Visible”. So just for a quick reference please find the code below. 
Bear in mind you will have to reference System.Reflection namespace. Also using Microsoft.SqlServer.ReportingServices2005.Execution namespace is not required nor Microsoft.ReportViewer.Common.dll assembly ref.


public void DisableUnwantedExportFormats()
{

    FieldInfo info;

    foreach (RenderingExtension extension in rvMain.ServerReport.ListRenderingExtensions())
    {
        if (extension.Name != &quot;PDF&quot; &amp;&amp; extension.Name != &quot;EXCEL&quot;) // only PDF and Excel - remove the others
        {
            info = extension.GetType().GetField(&quot;m_isVisible&quot;, BindingFlags.Instance &#124; BindingFlags.NonPublic);
            info.SetValue(extension, false);
        }

        if (extension.Name == &quot;EXCEL&quot;) // change &quot;Excel&quot; name on the list to &quot;Excel 97-2003 Workbook&quot;
        {
            info = extension.GetType().GetField(&quot;m_localizedName&quot;, BindingFlags.Instance &#124; BindingFlags.NonPublic);
            if (info != null) info.SetValue(extension, &quot;Excel 97-2003 Workbook&quot;);
        }
    }
}

Hope this helps!</description>
		<content:encoded><![CDATA[<p>I stumbled across similar challenge today using VS 2008 and SQL 2005 (9.00.4035.00). I found out that the “m_serverExtension” actually does not exists nor “Visible”. So just for a quick reference please find the code below.<br />
Bear in mind you will have to reference System.Reflection namespace. Also using Microsoft.SqlServer.ReportingServices2005.Execution namespace is not required nor Microsoft.ReportViewer.Common.dll assembly ref.</p>
<p>public void DisableUnwantedExportFormats()<br />
{</p>
<p>    FieldInfo info;</p>
<p>    foreach (RenderingExtension extension in rvMain.ServerReport.ListRenderingExtensions())<br />
    {<br />
        if (extension.Name != &#8220;PDF&#8221; &amp;&amp; extension.Name != &#8220;EXCEL&#8221;) // only PDF and Excel &#8211; remove the others<br />
        {<br />
            info = extension.GetType().GetField(&#8220;m_isVisible&#8221;, BindingFlags.Instance | BindingFlags.NonPublic);<br />
            info.SetValue(extension, false);<br />
        }</p>
<p>        if (extension.Name == &#8220;EXCEL&#8221;) // change &#8220;Excel&#8221; name on the list to &#8220;Excel 97-2003 Workbook&#8221;<br />
        {<br />
            info = extension.GetType().GetField(&#8220;m_localizedName&#8221;, BindingFlags.Instance | BindingFlags.NonPublic);<br />
            if (info != null) info.SetValue(extension, &#8220;Excel 97-2003 Workbook&#8221;);<br />
        }<br />
    }<br />
}</p>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [c#] Microsoft Report Viewer - Forum Fachinformatiker.de</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-21707</link>
		<dc:creator>[c#] Microsoft Report Viewer - Forum Fachinformatiker.de</dc:creator>
		<pubDate>Fri, 07 Aug 2009 08:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-21707</guid>
		<description>[...] f</description>
		<content:encoded><![CDATA[<p>[...] f</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-16668</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Mon, 18 May 2009 15:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-16668</guid>
		<description>If you&#039;re using Reporting Services with a DLL version of 9.0.0.0 (2008?) try Giulliano&#039;s code snippet instead. My code example only works with Reporting Services 2005.</description>
		<content:encoded><![CDATA[<p>If you&#8217;re using Reporting Services with a DLL version of 9.0.0.0 (2008?) try Giulliano&#8217;s code snippet instead. My code example only works with Reporting Services 2005.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-16488</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 15 May 2009 23:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-16488</guid>
		<description>I tried below code in my ReportViewer page, but does not work.  Please help.  Thanks,

           foreach (RenderingExtension extension in ReportViewer1.ServerReport.ListRenderingExtensions())
            {
                if (extension.Name == &quot;XML&quot;)
                {
                    FieldInfo info = extension.GetType().GetField(&quot;m_isVisible&quot;, BindingFlags.NonPublic &#124; BindingFlags.Instance);
                    if (info != null)
                    {
                        info.SetValue(extension, false);
                    }
                }

            }</description>
		<content:encoded><![CDATA[<p>I tried below code in my ReportViewer page, but does not work.  Please help.  Thanks,</p>
<p>           foreach (RenderingExtension extension in ReportViewer1.ServerReport.ListRenderingExtensions())<br />
            {<br />
                if (extension.Name == &#8220;XML&#8221;)<br />
                {<br />
                    FieldInfo info = extension.GetType().GetField(&#8220;m_isVisible&#8221;, BindingFlags.NonPublic | BindingFlags.Instance);<br />
                    if (info != null)<br />
                    {<br />
                        info.SetValue(extension, false);<br />
                    }<br />
                }</p>
<p>            }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

