Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I made a program that extracts all the ReportObjects from the .rpt files. For that I use this code:

ReportDocument objReportDocument = new ReportDocument();
objReportDocument.Load(FileName);
ReportObjects ReportObjects = objReportDocument.ReportDefinition.ReportObjects;


,which is working perfectly fine. Now the problem is that there are some report files which have subreports and I am not able to extract the ReportObjects from subreports. So if anyone know the way to get the ReportObjects from subreports, plz help.

P.S.: I used CrystalDecisions namespace to do that.

Thanks in Advance..
Posted

Thanks Guys,
Got the Solution.

SubreportObject objSubReportObject = (SubreportObject)objReportObject;
                    ReportDocument objSubReportDocument = objSubReportObject.OpenSubreport(objSubReportObject.SubreportName);
 
Share this answer
 
 
Share this answer
 
Comments
RBath 13-Oct-12 15:26pm    
i am trying to set can grow option programmatically but cannot determine how.
here is code i am for report
FileRoomListing myrptFileRoom = new FileRoomListing();
// ((FieldObject)myrptFileRoom.ReportDefinition.ReportObjects["matterdes"]).ObjectFormat.EnableCanGrow = true;
loadReportData(myrptFileRoom);


break;
}

}
private void loadReportData(CrystalDecisions.CrystalReports.Engine.ReportDocument myrpt1)
{
try
{

this.Width = 1000;
this.Height = 700;
MaintainReportViewer.ReportSource = myrpt1;
//this.MaintainReportViewer.ReportSource = myrpt1;
this.MaintainReportViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
myrpt1.DataSourceConnections[0].SetConnection("sqltest", "sqllarge", "sa", "esi");

MaintainReportViewer.ParameterFieldInfo = p;
if (prtflag == 1)
{
MaintainReportViewer.PrintReport();
}
//break;
}
catch (Exception ex1)
{
MessageBox.Show(ex1.Message);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900