<?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, 02 Apr 2012 03:52:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: oche</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-86874</link>
		<dc:creator>oche</dc:creator>
		<pubDate>Mon, 02 Apr 2012 03:52:56 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-86874</guid>
		<description>thank you very much for Giulliano Dias, I&#039;m using version 9.0.0.0 too
it&#039;s really a good solution for my problem :D</description>
		<content:encoded><![CDATA[<p>thank you very much for Giulliano Dias, I&#8217;m using version 9.0.0.0 too<br />
it&#8217;s really a good solution for my problem <img src='http://mikemason.ca/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<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: DABOS</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-64830</link>
		<dc:creator>DABOS</dc:creator>
		<pubDate>Tue, 06 Sep 2011 16:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-64830</guid>
		<description>Really good solution Thank you, I hope I will collaborate soon.</description>
		<content:encoded><![CDATA[<p>Really good solution Thank you, I hope I will collaborate soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luigi</title>
		<link>http://mikemason.ca/blog/2007/04/disabling-export-formats-in-reporting-services/comment-page-1/#comment-57409</link>
		<dc:creator>Luigi</dc:creator>
		<pubDate>Fri, 10 Jun 2011 21:35:17 +0000</pubDate>
		<guid isPermaLink="false">http://mikemason.ca/blog/?p=4#comment-57409</guid>
		<description>I wish to know how i should invoke the assembly code in the Visual Report Designer (MSDev), or implement this solution, someone says that in the Load Event, but i dont know exactly how is it !. Thanks in advance ..</description>
		<content:encoded><![CDATA[<p>I wish to know how i should invoke the assembly code in the Visual Report Designer (MSDev), or implement this solution, someone says that in the Load Event, but i dont know exactly how is it !. Thanks in advance ..</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>
</channel>
</rss>

