{"id":758,"date":"2008-01-04T19:58:12","date_gmt":"2008-01-05T02:58:12","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/19-9-exporting-to-pdf-rtf-word\/"},"modified":"2010-11-17T18:48:59","modified_gmt":"2010-11-18T01:48:59","slug":"19-9-exporting-to-pdf-rtf-word","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/19-9-exporting-to-pdf-rtf-word\/","title":{"rendered":"19.09 Exporting to PDF, RTF, Word"},"content":{"rendered":"<h2>Formatting for PDF, RTF, and Word Documents<\/h2>\n<p>Exporting a report to PDF, RTF or Word gives you the option to specify the page range. You can set the starting and ending page or simply print out the entire report. Note that all pages must be consecutively numbered. For example, you can&#8217;t export the first few pages of a report and the last few pages of a report. Table 19-7 shows the properties used for setting the page range.<\/p>\n<p>         <b>Table 19-7. PdfRtfWordFormatOptions Properties.<\/b><\/p>\n<table border=\"1\">\n<tr>\n<th>Property<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>FirstPageNumber<\/td>\n<td>The first page number to export<\/td>\n<\/tr>\n<tr>\n<td>LastPageNumber<\/td>\n<td>The last page number to export<\/td>\n<\/tr>\n<tr>\n<td>UsePageRange<\/td>\n<td>Boolean that enables\/disables the use of page ranges<\/td>\n<\/tr>\n<\/table>\n<p>         <caution>When exporting to Word, the process automatically inserts a footer at the bottom of each page that shows &#8220;Powered by Crystal&#8221; and the Crystal Decisions logo. If you want a continuous flow of data and you don&#8217;t want these page footers appearing in your spreadsheet, you have to open the document afterwards and clean it up manually. There is no way to keep this from happening prior to the export. See Figure 19-4 for an example.<\/caution><br \/>\n         <a href=\"http:\/\/www.crystalreportsonlinetraining.com\/Images\/CRNet2003\/Ch19\/image007.png\"><br \/>\n            <img decoding=\"async\" src=\"http:\/\/www.crystalreportsonlinetraining.com\/Images\/CRNet2003\/Ch19\/image008.jpg\"><br \/>\n            <\/img><br \/>\n         <\/a><br \/>\n         <b>Figure 19-4. An exported Word document with the Crystal icon.<\/b><br \/>\n         <code_Caption>Listing 19-5. Set the export formatting to PDF<\/code_Caption><br \/>\n         <code>Public Sub SetFormatPdfRtfWord(ByRef MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal UsePageRange As Boolean, ByVal FirstPageNumber As Integer, ByVal LastPageNumber As Integer)<\/code><br \/>\n         <code>'Change the next line if you want the format to be RTF or Word<\/code><br \/>\n         <code>MyReport.ExportOptions.ExportFormatType = _<\/code><br \/>\n         <code>CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat<\/code><br \/>\n         <code>'The following lines stay the same regardless of formatting<\/code><br \/>\n         <code>Dim Options As New CrystalDecisions.Shared.PdfRtfWordFormatOptions<\/code><br \/>\n         <code>Options.UsePageRange = UsePageRange<\/code><br \/>\n         <code>If UsePageRange Then<\/code><br \/>\n         <code>Options.FirstPageNumber = FirstPageNumber<\/code><br \/>\n         <code>Options.LastPageNumber = LastPageNumber<\/code><br \/>\n         <code>End If<\/code><br \/>\n         <code>MyReport.ExportOptions.FormatOptions = Options<\/code><br \/>\n         <code>End Sub<\/code><\/p>\n<p>The listing first sets the format type to PDF. If you want to export to RTF or Word, then change this line to be the appropriate enumeration needed. After setting the format type, create an options object and set the page range. If all the pages are going to be exported, then set the UsePageRange property to False. Otherwise, to print page ranges set it to True and also set the FirstPageNumber and LastPageNumber properties.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Formatting for PDF, RTF, and Word Documents Exporting a report to PDF, RTF or Word gives you the option to specify the page range. You can set the starting and ending page or simply print out the entire report. Note that all pages must be consecutively numbered. For example, you can&#8217;t export the first few [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,2],"tags":[],"class_list":["post-758","post","type-post","status-publish","format-standard","hentry","category-chapter-19-exporting-and-deploying-reports","category-crystal-reportsnet-2003","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/758","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=758"}],"version-history":[{"count":1,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/758\/revisions"}],"predecessor-version":[{"id":1671,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/758\/revisions\/1671"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=758"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}