Geeks With Blogs
CodeSeeker Just another developer trying to do the right thing

When exporting a Crystal Reports Basic for Visual Studio 2008 report in Excel, HTML, or PDF/RTF/Word format, you can specify formatting options for the export using an ExcelFormatOptions, HTMLFormatOptions, or PdfRtfWordFormatOptions object, respectively. Each FormatOptions object has 3 properties that can be set: UsePageRange, FirstPageNumber, and LastPageNumber. By default, their values are:

  • UsePageRange = False
  • FirstPageNumber = 1
  • LastPageNumber = 1

If you want to display all pages of the report, do not specify any of these properties (in fact, you do not need a FormatOptions object at all). If UsePageRange = False, FirstPageNumber and LastPageNumber are ignored, and again the object is not used and can be removed. If UsePageRange = True, both FirstPageNumber and LastPageNumber are considered. If one or both of them are not specifed, their default values are used. As their names suggest, FirstPageNumber specifies on which page of the report to start and LastPageNumber specifies on which page to end.

I learned about these options and how they work because I had UsePageRange = True, FirstPageNumber = 1, and LastPageNumber unspecified, and only one of the pages of the report was displaying. By removing all of the options, all pages of the report then displayed. I also found that the Crystal Reports documentation was very terse on this subject, so with some experimenting, I compiled the above information. It may also apply to other FormatOptions objects with these properties in other versions of Crystal Reports, but the above was all I had to work with.

Posted on Thursday, January 21, 2010 6:53 PM | Back to top

Copyright © Mike Ellis | Powered by: