Hello all,
Is there any way to bind properties of a report object - specifically the "Height" property - to another object on the report?
My gut tells me that this would require the Crystal reports engine to do two passes (or more - one to set the data and another to adjust the fields), and I don't believe it does this. However, section height is calculated automatically, so I'm hopeful that what I want is possible.
Example:
I have a row that has background color provided by a box (or some other object that can have a fill color). The fields in the row have CanGrow set to true. However, when they do grow, they grow larger than the item that provides the background color.
Excuse my lack of ascii art skill (I can't insert an image, so I'm trying to draw the box that provides the background color and a field inside it):
This is ok for fields that do not overflow:
_________ ___________
|_________| + Field = |_Field_____|
Everything looks as expected with the text inside the box.
This is desired for fields that DO overflow:
_________ __________
|_________| + Overflow Field = | Overflow |
|_Field____|
Everything looks as expected with the text inside the expanded box.
This is the actual result for fields that overflow.
_________ ___________
|_________| + Overflow Field = |_Overflow__|
Field
The text has expanded past the box, while the box remains the same size.
Hopefully, you can see from my crude drawings what I'm trying to accomplish. I want the box's height to be bound to the height of the field that overflowed. I can set the CanGrow property to true on the box, but this doesn't work (and I wouldn't expect it to, because there is nothing in the box that "grows").
-----
I assume the suggested anwer will have something to do with conditionally setting the section background or adding a subreport, so I'll address that idea here.
- I'm aware that I can make the section change its background color conditionally. This doesn't work for me because I don't want color bleeding to the end of the page.
- I know I can make my report a subreport and provide an artificial margin on the left/right sides of the report, but this makes me lose the ability of being able to programmatically access the subreport's fields through the CR API. This tradeoff is too great for me because of the heavy use of programmatic access to the API that I use.
The only way I can see the subreport option working is if:
1) I actually can access the subreport's data (i.e. I'm incorrect in my assumption that I can't)
2) I have the ability to programmatically re-import the subreport to the main report (while restoring foreign key relationships)
-----
I've put in a lot of time trying solving issues that I feel should be easy for a reporting engine, but this one has me stumped. I've browsed around and there are some very clever people here, so I have faith that the answer is out there somewhere (I just hope it's on these forums

).
Thank you,
Mick