In the Line of Fire….Shaunak Pandit

Random thoughts abt life and my work (in the line of fire between Testers,Managers and clients)

Setting margins while printing Crystal reports.

Posted by Shaunak Pandit on September 10, 2008

Crystal reports provides its own printing method, which will print the page but there might be some problems in the print out unless you set the margins for the page.

PageMargins margins = new PageMargins();
‘ Get the PageMargins structure and set the ‘ margins for the report.
margins = rep.PrintOptions.PageMargins;
margins.bottomMargin = 350;
margins.leftMargin = 350;
margins.rightMargin = 350;
margins.topMargin = 350; ‘ Apply the page margins.
rep.PrintOptions.ApplyPageMargins(margins);
‘ Print the report.
Set the startPageN and endPageN
‘parameters to 0 to print all pages.
rep.PrintToPrinter(1, False, 0, 0);

PrinttoPrinter method of Crystal reports

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>