C# ExportaCrystalReporttoFile Snippets

C# ExportaCrystalReporttoFile Snippets

11. June 2009

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>
FacebookDigg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

C#

Comments

4/15/2010 3:05:10 AM #
Awesome post! Interesting info to know.  
5/17/2010 12:28:36 AM #
I searched this topic and found out that most people will agree with your blog.
5/21/2010 5:09:30 PM #
Hi admin, your web page's design is fancy and i like it. Your posts are great. Please continue this great work. Cheers!!
5/22/2010 1:30:43 AM #
There are certainly a lot more details to take into consideration, but thanks for sharing this information

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Sayfa 0.03125 saniyede yuklendi.