{"id":627,"date":"2008-01-04T19:47:32","date_gmt":"2008-01-05T02:47:32","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/14-7-setting-the-report-options\/"},"modified":"2010-11-17T18:43:06","modified_gmt":"2010-11-18T01:43:06","slug":"14-7-setting-the-report-options","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/14-7-setting-the-report-options\/","title":{"rendered":"14.07 Setting the Report Options"},"content":{"rendered":"<h2>Setting the Report Options<\/h2>\n<p>The ReportOptions class only has a few properties that can be set. They are listed in Table 14-2. This information is set during design mode by right-clicking on the report and selecting Designer | Default Settings and selecting the Reporting tab. These properties were discussed in Chapter 2.<\/p>\n<p>         <b>Table 14-2. Properties of the ReportOptions class.<\/b><\/p>\n<table border=\"1\">\n<tr>\n<th>Property<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>EnableSaveDataWithReport<\/td>\n<td>Saves the latest data with the report. Allows report to be opened without a live data connection.<\/td>\n<\/tr>\n<tr>\n<td>EnableSavePreviewPicture<\/td>\n<td>Saves a thumbnail picture of the report.<\/td>\n<\/tr>\n<tr>\n<td>EnableSaveSummariesWithReport<\/td>\n<td>Saves data summaries with the report.<\/td>\n<\/tr>\n<\/table>\n<p>The following example sets the EnableSaveDataWithReport property to True.<\/p>\n<p>         <code>Dim MyReport As New CrystalReport1<\/code><br \/>\n         <code>MyReport.ReportOptions.EnableSaveDataWithReport = True<\/code><\/p>\n<h2>Connecting to the Data Sources<\/h2>\n<p>The Database class is used for examining the tables used in a report and their relationships with each other. It&#8217;s also used for setting the login information before opening the report. This class is described in Chapter 17.<\/p>\n<h2>Modifying the Printing Options<\/h2>\n<p>The PrintOptions class stores the options for how a report is sent to the printer. This can consist of the destination printer, the paper orientation or the page margins. This is normally set during design mode. While the majority of an application&#8217;s reports will use the same settings, you can override the default settings for specific reports. Table 14-3 lists the properties.<\/p>\n<p>         <b>Table 14-3. PrintOptions properties.<\/b><\/p>\n<table border=\"1\">\n<tr>\n<th>Property<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>PageMargins<\/td>\n<td>Gets the page margins.<\/td>\n<\/tr>\n<tr>\n<td>ApplyPageMargins()<\/td>\n<td>Sets new page margins.<\/td>\n<\/tr>\n<tr>\n<td>PaperOrientation<\/td>\n<td>Switch between Landscape and Portrait.<\/td>\n<\/tr>\n<tr>\n<td>PaperSize<\/td>\n<td>Set the paper size using pre-defined size constants.<\/td>\n<\/tr>\n<tr>\n<td>PaperSource<\/td>\n<td>Set the tray that the paper is printed from.<\/td>\n<\/tr>\n<tr>\n<td>PrinterName<\/td>\n<td>Change the printer by passing a string that exactly matches the printer name listed in the Printers Control Panel.<\/td>\n<\/tr>\n<\/table>\n<p>Each of these properties is easy to modify. In same cases you will have to use a predefined constant to set the property (e.g. PaperOrientation and PaperSize).<\/p>\n<p>         <caution>Changing the printer name can cause the report output to be scrambled. Each printer uses a unique printer language for producing output. If the new printer doesn&#8217;t use the same printer language as the default printer that the report was designed to use, then the report will not print correctly. For example, if a report was designed for use with an HP printer, then it is okay to switch between similar models of an HP printer. But printing this report to Acrobat PDFWriter will result in an unreadable PDF file.<\/caution><br \/>\n         <code_Caption>Listing 14-4. Change a report&#8217;s printer settings.<\/code_Caption><br \/>\n         <code>Dim MyReport As New CrystalReport1<\/code><br \/>\n         <code>MyReport.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape<\/code><br \/>\n         <code>MyReport.PrintOptions.PrinterName = \"HP LaserJet510\"<\/code><br \/>\n         <code>MyReport.PrintToPrinter(1, False, 0, 0)<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting the Report Options The ReportOptions class only has a few properties that can be set. They are listed in Table 14-2. This information is set during design mode by right-clicking on the report and selecting Designer | Default Settings and selecting the Reporting tab. These properties were discussed in Chapter 2. Table 14-2. Properties [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,2],"tags":[],"class_list":["post-627","post","type-post","status-publish","format-standard","hentry","category-chapter-14-programming-reports","category-crystal-reportsnet-2003","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":1,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":1631,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/627\/revisions\/1631"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}