Read this article in your language IT | EN | DE | ES
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Export a Crystal Report to a file</Title>
<Author>Business Objects</Author>
<Description>The following code example exports a Crystal Report to a file. For this code snippet to compile, add a reference to CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll.</Description>
<HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
<Shortcut>crExportRptToDisk</Shortcut>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>FileName</ID>
<ToolTip>Replace this string with the name of the report file you want to export from.</ToolTip>
<Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
</Literal>
<Literal>
<ID>ExportFormatType</ID>
<ToolTip>Replace this value with the export format Type that you want to export the report to.</ToolTip>
<Default>PortableDocFormat</Default>
</Literal>
<Literal>
<ID>DestinationFileName</ID>
<ToolTip>Replace this string with the file name you want to export the report to.</ToolTip>
<Default>"C:\My Crystal Reports\Report Name.pdf"</Default>
</Literal>
<Literal Editable="false">
<ID>ReportDocumentClass</ID>
<Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
</Literal>
<Literal Editable="false">
<ID>ExportFormatTypeClass</ID>
<Function>SimpleTypeName(CrystalDecisions.Shared.ExportFormatType)</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[// You can change other export options like page range by calling Export method with an ExportOptions object.
$ReportDocumentClass$ report = new $ReportDocumentClass$();
report.Load(@$FileName$);
report.ExportToDisk($ExportFormatTypeClass$.$ExportFormatType$, @$DestinationFileName$);
report.Close();$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
99f855ad-3997-4cac-82ee-1e7a8b2747e7|0|.0
C#
c#