ActiveReports for .NET 2.0 Support

Started by smarch at 03-08-2010 12:11 PM. Topic has 11 replies.

Print Search Rate
Sort Posts:    
   03-08-2010, 12:11 PM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Adding subreports at runtime?
is it possible to add subreports at runtime without having a design time placeholder?
   Report 
   03-08-2010, 11:53 PM
AnkitN is not online. Last active: 6/8/2010 6:43:55 AM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 844

DDStaff
Re: Adding subreports at runtime?
Hello,

Do you want to add a subreport control on the main report at runtime? If yes then you can add subreport control at runtime by instantiating the subreport control in the main report. After instantiating you can add this control to the desired section of the report. For example:

DataDynamics.ActiveReports.SubReport mySub;
private void Customers_ReportStart(object sender, System.EventArgs eArgs)
{
   mySub = new DataDynamics.ActiveReports.SubReport();           
   this.Sections["Detail"].Controls.Add(mySub);
}


If I misunderstood the issue then I request you to provide more information about your requirements.

Regards,
Ankit Nigam


   Report 
   03-09-2010, 9:54 AM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
Ankit,
thanks for the reply.

shall i do the above in report start event or i can do it in section_format event also?


   Report 
   03-09-2010, 11:25 AM
PrantikS is not online. Last active: 2/10/2012 5:46:35 PM PrantikS

Top 25 Posts
Joined on 12-11-2008
Posts 1,550

DDStaff
Re: Adding subreports at runtime?
Hello,

If you are adding the controls at runtime, you would need to do that on the reportstart event.

Regards,
Prantik


   Report 
   03-09-2010, 3:00 PM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
can we add more than one subreport to one section? If yest how do i make sure that they dont overlap each other?
   Report 
   03-09-2010, 10:45 PM
AnkitN is not online. Last active: 6/8/2010 6:43:55 AM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 844

DDStaff
Re: Adding subreports at runtime?
Hello,

You can add multiple subreport controls in a section but it my get extremely complicate depending on the number of subreports. You can also set there location in a section to avoid overlapping.

To know more about runtime reporting you may check this walkthrough.

You can also check this from thread in which similar issue had been discussed earlier.

Regards,
Ankit Nigam


   Report 
   03-13-2010, 9:41 PM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
I tried in a simple way, but the second sub report is covering the first one.

-----
mySub1 = New DataDynamics.ActiveReports.SubReport()
mySub1.Report = New TestARSrpt4411
Me.Sections("Detail").Controls.Add(mySub1)

mySub2 = New DataDynamics.ActiveReports.SubReport()
mySub2.Report = New TestARSrpt4422
Me.Sections("Detail").Controls.Add(mySub2)

-----

I guess I need to find a way to know the height of the sub reports and be able to set the top (in HTML sense) of succeding ones so that they donot cover each other.

Am I thinking in the right direction?
Can you point me to some resources/reference materials to implement this task?

Thanks.


   Report 
   03-15-2010, 12:35 PM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
Is it possible to change the position.y property of sub report at run time?

i am trying to acheive "multiple subreports in the same section at run time", but looks like it may not be possible using active reports, anyone?
   Report 
   03-15-2010, 2:42 PM
AnkitN is not online. Last active: 6/8/2010 6:43:55 AM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 844

DDStaff
Re: Adding subreports at runtime?
Hello,

You can use the following code snippet to add two subreport controls in the detail section of the main report:

private void NewActiveReport1_ReportStart(object sender, EventArgs e)
        {
            mySub1 = new DataDynamics.ActiveReports.SubReport();
            mySub1.Name = "Sub1";
            mySub1.Size = new System.Drawing.Size(6, 1);         
            this.Sections["detail"].Controls.Add(mySub1);

            mySub2 = new DataDynamics.ActiveReports.SubReport();
            mySub2.Name = "Sub2";
            mySub2.Size = new System.Drawing.Size(6, 1);            
            this.Sections["detail"].Controls.Add(mySub2);
           
        }

private void detail_Format(object sender, EventArgs e)
        {
            NewActiveReport2 rpt1 = new NewActiveReport2();
            NewActiveReport3 rpt2 = new NewActiveReport3();
            mySub1.Report = rpt1;
            mySub2.Location = new PointF(0.0f, mySub1.Height);
            mySub2.Report = rpt2;       
        }


Regards,
Ankit Nigam


   Report 
   03-16-2010, 8:10 AM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
-----
mySub1.Size = new System.Drawing.Size(6, 1);

-----

Will that not restrict/limit the height of the sub report to a arbitrary number we chose?

what if the height needs to be more depending on the content?
   Report 
   03-16-2010, 8:45 AM
smarch is not online. Last active: 10/26/2011 3:29:28 PM smarch

Top 500 Posts
Joined on 08-28-2004
Baton Rouge,LA
Posts 37
Re: Adding subreports at runtime?
Private Sub TestAR44_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReportStart
mySub1 = New DataDynamics.ActiveReports.SubReport()
mySub1.Name = "Sub1"
mySub1.Size = New System.Drawing.Size(6, 1)
Me.Sections("Detail").Controls.Add(mySub1)

mySub2 = New DataDynamics.ActiveReports.SubReport()
mySub2.Name = "Sub2"
mySub2.Size = New System.Drawing.Size(6, 1)
Me.Sections("Detail").Controls.Add(mySub2)
End Sub

Private Sub Detail_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles Detail.Format
mySub1.Report = New TestARSrpt4411
mySub2.Location = New System.Drawing.PointF(0.0F, mySub1.Height)
Debug.WriteLine("sub1 height=" & mySub1.Height)
mySub2.Report = New TestARSrpt4422
End Sub

-------------------

this is what I am getting in Output window:

sub1 height=1

-------------------
   Report 
   03-16-2010, 12:05 PM
AnkitN is not online. Last active: 6/8/2010 6:43:55 AM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 844

DDStaff
Re: Adding subreports at runtime?
Hello,

You can determine the height of the subreport control in the Section’s BeforePrint event. As I already informed you that it is quite complicated to adjust the multiple subreports in the same section at the run time, because you can only determine the height of subreport control in the before print event.

Regards,
Ankit Nigam


   Report 
GrapeCity » Product Support » ActiveReports f... » Adding subreports at runtime?

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.