C# .NET - How to customize a size of crystal report

Asked By Daniel on 06-Mar-12 02:10 PM
Earn up to 10 extra points for answering this tough question.
Hi!I want to customize my crystal report or crystal report viewer by giving it the a small size.Please help fixing this.
let me give u an exemple then tell me if I have to resize a crystal report or crystal report viewer that support the crystal report.
see the report below and tell me how I can do the same:

kalpana aparnathi replied to Daniel on 06-Mar-12 02:25 PM
hi,

Try below code for size:

string printerName = GetPrinterName();
  if (printerName != null)
  {
    cr.PrintOptions.PaperSource = PaperSource.Auto;
    cr.PrintOptions.PaperSize = PaperSize.DefaultPaperSize;
 
   CrystalDecisions.Shared.PageMargins edges = new CrystalDecisions.Shared.PageMargins(1, 1, 1, 1);
   cr.PrintOptions.ApplyPageMargins(edges);
 
   crystalReportViewer1.ReportSource = cr;
   crystalReportViewer1.Refresh();
 
   cr.PrintOptions.PrinterName = printerName;
   cr.PrintToPrinter(1, false, 0, 0);
  }

Regards,
Somesh Yadav replied to Daniel on 07-Mar-12 12:21 AM

Hi,

Please refer following

http://www.codeproject.com/KB/custom-controls/ASPNETPagerControl.aspx

http://msdn.microsoft.com/en-us/library/ms972960.aspx

http://www.asp.net/data-access/tutorials/efficiently-paging-through-large-amounts-of-data-cs 

hope this helps
Reena Jain replied to Daniel on 07-Mar-12 12:42 AM
hi,

To set height programatically you have to set it in pixels

Set the width and height in code like this

CrystalReportViewer2.BestFitPage=false;
CrystalReportViewer2.Width = new Unit("2000px");
CrystalReportViewer2.Height = new Unit("2000px");


The default setting for the CR Viewer is BestFitPage=true, and that could be overriding your setting

or check this link
http://www.eggheadcafe.com/community/csharp/2/10063289/crystal-report-design.aspx