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>Print a Crystal Report </Title>
<Author>Business Objects</Author>
<Description>The following code example prints a Crystal Report to the printer specified in the PrintOptions. 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>crPrintRpt</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 print.</ToolTip>
<Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
</Literal>
<Literal>
<ID>copies</ID>
<ToolTip>Replace this number with the number of copies of Crystal Report you want to print.</ToolTip>
<Default>1</Default>
</Literal>
<Literal>
<ID>collated</ID>
<ToolTip>Replace this boolean with false if you do not want to print the Crystal Report collated.</ToolTip>
<Default>true</Default>
</Literal>
<Literal>
<ID>startPage</ID>
<ToolTip>Replace this number with the first page number to print; use 0 to specify whole report.</ToolTip>
<Default>0</Default>
</Literal>
<Literal>
<ID>endPage</ID>
<ToolTip>Replace this number with the last page number to print; use 0 to specify whole report.</ToolTip>
<Default>0</Default>
</Literal>
<Literal Editable="false">
<ID>ReportDocumentClass</ID>
<Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[// You can change more print options via PrintOptions property of ReportDocument
$ReportDocumentClass$ report = new $ReportDocumentClass$();
report.Load(@$FileName$);
report.PrintToPrinter($copies$, $collated$, $startPage$, $endPage$);
report.Close();$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
43173a96-7b0e-4d3a-a5af-32e05968582c|0|.0
C#
c#