Visual Studio Development Bookmark and Share   
 index > Crystal Reports for Visual Studio > how to cutomizing crystal report in runtime
 

how to cutomizing crystal report in runtime

i want to know how to cutomizing crystal report in runtime
dhanu30864  Friday, July 10, 2009 6:45 AM

we can control every object in the report.

for example, we control one textboxObject and one filedObject

use ReportDocument to control.

ReportDocument myReport = new ReportDocument();
string reportPath = Server.MapPath("crystalreport1.rpt");
myReport.Load(reportPath);

//set datasource or database logon information
//...
CrystalReportViewer1.ReportSource = myReport;

//control the report object
//one textbox named "Text1",set its Left/Top ,and Its Text
//this is a common object
myReport.ReportDefinition.ReportObjects["Text1"].Left=567*2; //2cm

//control textboxobject
TextObject x;
x = (TextObject)myReport.ReportDefinition.ReportObjects["Text1"];
x.Text = "Customize Text";

//control  fieldObject
//fieldObjectName<>filedname, right click the field,get the fieldnane(object name)
FieldObject fo;
fo = (FieldObject)myReport.ReportDefinition.ReportObjects["fieldObjectName"];
fo.Height = 567 * 3;
fo.Width = 567 * 4;
fo.Left = 567 * 1;

  • Edited byaTai Saturday, July 11, 2009 12:48 AMedit
  • Edited byaTai Saturday, July 11, 2009 12:49 AM
  • Marked As Answer byHarry ZhuMSFT, ModeratorThursday, July 16, 2009 11:22 AM
  •  
aTai  Saturday, July 11, 2009 12:48 AM
Khanna Gaurav  Friday, July 10, 2009 11:14 AM

we can control every object in the report.

for example, we control one textboxObject and one filedObject

use ReportDocument to control.

ReportDocument myReport = new ReportDocument();
string reportPath = Server.MapPath("crystalreport1.rpt");
myReport.Load(reportPath);

//set datasource or database logon information
//...
CrystalReportViewer1.ReportSource = myReport;

//control the report object
//one textbox named "Text1",set its Left/Top ,and Its Text
//this is a common object
myReport.ReportDefinition.ReportObjects["Text1"].Left=567*2; //2cm

//control textboxobject
TextObject x;
x = (TextObject)myReport.ReportDefinition.ReportObjects["Text1"];
x.Text = "Customize Text";

//control  fieldObject
//fieldObjectName<>filedname, right click the field,get the fieldnane(object name)
FieldObject fo;
fo = (FieldObject)myReport.ReportDefinition.ReportObjects["fieldObjectName"];
fo.Height = 567 * 3;
fo.Width = 567 * 4;
fo.Left = 567 * 1;

  • Edited byaTai Saturday, July 11, 2009 12:48 AMedit
  • Edited byaTai Saturday, July 11, 2009 12:49 AM
  • Marked As Answer byHarry ZhuMSFT, ModeratorThursday, July 16, 2009 11:22 AM
  •  
aTai  Saturday, July 11, 2009 12:48 AM

You can use google to search for other answers

Custom Search

More Threads

• problem with crystal report not find data base path
• Displaying RTF data in Crystal report
• Anyone ever worked with Tobit Faxware?
• Cross Tab Fit In One Pages
• Generate daily, weekly, monthly, yearly report for profit/loss
• The report has no table.
• Date-Time error in the select formula.
• Reporting in VB .Net 2005
• Add picture to crystal report from xsd dataset
• I can't find the short-cut icon to launch crystal reports