IntroductionIn this snippet, i'm going to show to How to Resize Image in Crystal Report Visual Studio 2005.The crystal report is most powerful tool to create reports for all business application, at the same time, crystal report has few limitation or indirect way to achieve a function. One of my project , i have created a report with client logo images. but its to big, so i decide to resize the image with few lines or of C# code.here i'm going to share that code for you all. Note:1 pixel should be equal to 15 twips in Crystal Report. Code int LogoWidth = 100;
int LogoHeight = 80;
reportdocument.Load("abc.rpt");
reportdocument.SetDataSource(myDataTable);
reportdocument.Section2.ReportObjects["LogoImage1"].Width = LogoWidth * 15;
reportdocument.Section2.ReportObjects["LogoImage1"].Height = LogoHeight * 15;
CrystalReportViewer.ReportSource = reportdocument; In lines of code,i have declare my logo width and height. then set the data source to report(this is default). then i know what is section of the my logo.then read the object from the crystal report section collection and then width and height. Access Image object Codereportdocument.Section2.ReportObjects["LogoImage1"].Width = LogoWidth * 15;
reportdocument.Section2.ReportObjects["LogoImage1"].Height = LogoHeight * 15; That's all.i hope this is help to all. |