Print Page | Close Window

PaperSize A6

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1244
Printed Date: 04 May 2024 at 12:56am


Topic: PaperSize A6
Posted By: rominita
Subject: PaperSize A6
Date Posted: 29 Aug 2007 at 2:57am
Hello, I want to print a report in A6 format but this format is not defined from the PaperSize class. Someone can help me? In version XI is implemented this functionality?
Sorry for my English!
Thank you!!!



Replies:
Posted By: jkwrpc
Date Posted: 29 Aug 2007 at 1:01pm
CR XI determines the paper sizes available based on the printer. If you need A6 you will need to use a printer that supports that size.  You can change the printer by clicking on the Printer button in the File->Page Setup menu. Once that is done you should see A6 as a paper size choice.
 
Hope this helps
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: jkwrpc
Date Posted: 29 Aug 2007 at 1:02pm

I just reread your post, were looking to do this in code vs. the Report Designer?

 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: rominita
Date Posted: 30 Aug 2007 at 5:52am
Hi! Thanks a lot for your answer. My problem is setting paper size from code. 
In a Report Disegner in a Printer Setup menu I had put A6 format, and the report is corretted, but when export Report in a pdf, if itsn't specificated papersize, the size is 11 x 8,50 inch (that it correspond at define PaperSize.PaperLetter Confused). I'm making a web application and using c#. 
For example:
ReportDocument crReportDocument;
ExportOptions crExportOptions;
DiskFileDestinationOptions crDiskFileDestinationOptions;
crReportDocument = new ReportDocument();
// A5
crReportDocument.Load(Request.PhysicalApplicationPath + " file://\\Report\\CrystalReport_A5.rpt - \\Report\\CrystalReport_A5.rpt ");
crReportDocument.PrintOptions.PaperSize = PaperSize.PaperA5;
crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
        
crReportDocument.RecordSelectionFormula = "({StampaEtichetta.id} = 1)";
        
// Sets the logon info matching tables to admin as the user name and pass as the password
SetDatabaseLogonReport(crReportDocument, this);
//Export to PDF
crDiskFileDestinationOptions = new DiskFileDestinationOptions();
        
//append a filename to the export path and set this file as the filename property for
//the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = Request.PhysicalApplicationPath + Session.SessionID.ToString() + ".pdf";
crExportOptions = crReportDocument.ExportOptions;
//set the required report ExportOptions properties
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
       
//Once the export options have been set for the report, the report can be exported. The Export command
//does not take any arguments
try
{
            // Export the report
            crReportDocument.Export();
            crReportDocument.Close();
            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-disposition", "attachment;  filename=\"Etichetta.pdf\"");
           
            Response.WriteFile(crDiskFileDestinationOptions.DiskFileName);
            Response.Flush();
            Response.Close();
            System.IO.File.Delete(crDiskFileDestinationOptions.DiskFileName);
}
catch (Exception err)
{
            Response.Write("<BR>");
            Response.Write(err.Message.ToString());
}



Print Page | Close Window