cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically positioning subreports inside of a section

Former Member
0 Kudos

Is it possible to programmatically set the position of a subreport inside

of a section? I am currently programmatically creating subreports inside

of a report.

If I add a new detail section for each subreport it works fine,

but I quickly exceed the maximum number of sections. I tried adding

multiple subreports to the same section, but they end up on top of each

other.

Is there a way to have 2 objects above of each other in the same

section, both with the "Enable Can Grow" property set to true and the top

one bump the bottom one down?

I am using VB.Net with Crystal XI

(Please don't send this to the design team, I am doing this programmatically

- not using the designer)

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Jeff,

Yes, use the object browser and find or search on Top, Left and Height...

CrystalDecisions.CrystalReports.Engine.ReportObject.Height

The subreport is an object but to set the size and location use the main report objecttype = subreport

What you want to do is set the subreport object top, left and height and use the Can grow option also. When this is turned on it should push the following subreport down the page... Generically when inserting the subreports space them accordingly.

Just one warning, for each subreport that is inserted it will make a new database connection. If you place the subreport in the detail section for instance for every record returned it will run the subreport and thus open up a DB connection etc. Example: Main report returns 1000 records, 2 subreprots in the detail section will cause each subreport to run 1000 times. Just be careful how you layout the report or your users/customers will see a huge delay in report processing.

Thank you

Don

Former Member
0 Kudos

That sounds like it will do the trick. I will try this out. As far as database connection, it is just connecting to a local XML file, so there is no DB bandwidth issue here.

Thanks,

Jeff

Former Member
0 Kudos

Hello Jeff,

to give yuou some more hints you can download a CS sample for VS 2005 [How to add a Subreport|ftp://ftp.businessobjects.com/pub/incoming/NET-CS2005_RAS-Unmanaged_CR115_Add_Subreport.zip].

This sample demonstrates how to add a subreport using unmanaged inproc RAS.

I hope it answers all your questions.

Best regards

Falk

Former Member
0 Kudos

If I have a ReportDocument, what would be the syntax to get:

CrystalDecisions.CrystalReports.Engine.ReportObject.Height

Thanks,

Jeff

Former Member
0 Kudos

Falk,

The example you refer to just shows how to programmatically add a simple subreport, I don't have any problem with this. I need to know how to align the top and height of each when I have many subreports to programmatically add. I think Don's suggestion should be the solution, but I cannot find this object he is referring to.

Adding 1 per section works, but is limited. I need to know how to determine the height of each subreport and then set the top accordingly on each of them.

Thanks,

Jeff

Answers (0)