locked
Crystal report - Page Size

    Question

  • Is it possible to set one page size for viewing the report in crystal report viewer and another page size setting for exporting the report.

    If yes , tell me how?
    Wednesday, May 02, 2007 4:44 AM

Answers

  • This is similar to your other question I answered about inserting a picture.  The answer is pretty much the same.  Exporting in Crystal exports the current view of the report.  If you are using the Crystal viewer control, and click the export button, what you see is what you get.  If you create your own export routine, you can programtically change the report in almost any way you wish and export that.

     

    So to answer this question, you can programatically change the page size for exporting, provided that you supply the export code.  You would do it like:

     

    report.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.Paper11x17;

     

    Obviously change the paper size to what you want.  There is a problem with this though.  I don't think there is any way to force the  report objects to resize themselves with the new paper size.  You would have to programatically grab each object and resize it to make it look right at the new page size.  If someone knows of another way, please correct me.

     

    It would probably be easier to create two versions of the report, one for viewing and one for export.  That way you could write your own export routine to export the other version and not hassle with all of the programming details of resizing.

     

    Here is an example of what I mean by writing your own export routine:

     

       Report report = new Report();
         report.SetDataSource(reportData);

       DiskFileDestinationOptions disk = new DiskFileDestinationOptions();
         disk.DiskFileName = filePath;

       ExportOptions export = report.ExportOptions;
         export.ExportFormatType = ExportFormatType.PortableDocFormat;
         export.ExportDestinationType = ExportDestinationType.DiskFile;
         export.DestinationOptions = disk;

       report.Export();

    Wednesday, May 02, 2007 1:06 PM

All replies

  • This is similar to your other question I answered about inserting a picture.  The answer is pretty much the same.  Exporting in Crystal exports the current view of the report.  If you are using the Crystal viewer control, and click the export button, what you see is what you get.  If you create your own export routine, you can programtically change the report in almost any way you wish and export that.

     

    So to answer this question, you can programatically change the page size for exporting, provided that you supply the export code.  You would do it like:

     

    report.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.Paper11x17;

     

    Obviously change the paper size to what you want.  There is a problem with this though.  I don't think there is any way to force the  report objects to resize themselves with the new paper size.  You would have to programatically grab each object and resize it to make it look right at the new page size.  If someone knows of another way, please correct me.

     

    It would probably be easier to create two versions of the report, one for viewing and one for export.  That way you could write your own export routine to export the other version and not hassle with all of the programming details of resizing.

     

    Here is an example of what I mean by writing your own export routine:

     

       Report report = new Report();
         report.SetDataSource(reportData);

       DiskFileDestinationOptions disk = new DiskFileDestinationOptions();
         disk.DiskFileName = filePath;

       ExportOptions export = report.ExportOptions;
         export.ExportFormatType = ExportFormatType.PortableDocFormat;
         export.ExportDestinationType = ExportDestinationType.DiskFile;
         export.DestinationOptions = disk;

       report.Export();

    Wednesday, May 02, 2007 1:06 PM
  • I am working on Crystal reports xi release 2. It is working fine. We are using .Net 2005 Dataset to bind with reports.

    But when we print or export the report all the pages are exported. But the user want us to implement a custom button which will only export the current viewing page. It is a web application and the export type is in PDF. Please let me know if you need any more clarifications.

    Wednesday, May 09, 2007 12:11 PM