<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Serge&#039;s Technology View &#187; set default export file name</title>
	<atom:link href="http://blog.dragonsoft.us/tag/set-default-export-file-name/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dragonsoft.us</link>
	<description>Talk about Technologies, Software Architecture and Management</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:43:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to set default file name for export from CrystalReportViewer in ASP.Net</title>
		<link>http://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/</link>
		<comments>http://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 20:20:57 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[crystalreportviewer]]></category>
		<category><![CDATA[set default export file name]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=921</guid>
		<description><![CDATA[I have had nice discussion about a new Crystal Reports based web-site today. And everything seems to be fine&#8230; Except users want to see a proper default name for the exported files&#8230; Environment: Crystal Reports 2008 engine IIS 7 ASP.Net &#8230; <a href="http://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have had nice discussion about a new Crystal Reports based web-site today. And everything seems to be fine&#8230; Except users want to see a proper default name for the exported files&#8230;</p>
<p>Environment:</p>
<ul>
<li>Crystal Reports 2008 engine</li>
<li>IIS 7</li>
<li>ASP.Net 3.0 page with CrystalReportViewer (CRV) being used to show report passed by parameter</li>
</ul>
<p>When trying export as PDF (just an example), CRV defaults the name of the file to <em>CrystalReportViewer1.pdf.<br />
</em>Not very nice since associated RPT name is <em>MyVeryOwnReport.rpt</em> and I have many other which I would expect export file at least inherit.</p>
<p>One would expect that Viewer would have a property allowing specify default export name. Not so fast&#8230; there is no such thing today exists.</p>
<p>After some head scratching and research, it just happen that Default Export File Name is actually based of the ID property value of the CRV which is still named as CrystalReportViewer1.</p>
<p>Options?</p>
<ol>
<li>Rename ID value of the control as something else. Still, if we use just one page and load reports dynamically, then it would not help much.
<pre class="brush: csharp; title: ; notranslate">// ReportPreview.aspx file
&lt;CR:CrystalReportViewer ID=&quot;MyVeryOwnExportFile&quot; /&gt;</pre>
</li>
<li>Another option is to populate Default Export file name in the code
<pre class="brush: csharp; title: ; notranslate">// ReportPreview.aspx.cs file
protected void Page_Init(object sender, EventArgs e)
{
     ...
    // Load report here
    ...
    CrystalReportViewer1.ID = &quot;MyVeryOwnExportFile&quot;;
}</pre>
<p>It is important to have it set before any code would use it to manipulate a page view state and create references.</p>
</li>
<li>Trying <a href="http://msdn.microsoft.com/en-us/library/aa288404(VS.71).aspx" target="_blank">manually set export options</a> for the Report instance, would not help much unfortunately since viewer would disregard it.</li>
<li>Off course there is always an option of coding export functionality yourself and bypass built-in logic&#8230;</li>
</ol>
<p>This concludes another Crystal Reports dance session.</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2012 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2009/04/07/how-to-set-default-file-name-for-export-from-crystalreportviewer-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

