Hierarchical master detail

Stimulsoft Reports.NET discussion
Post Reply
Jacco van der Pol
Posts: 4
Joined: Thu Apr 03, 2008 7:00 am
Location: Netherlands

Hierarchical master detail

Post by Jacco van der Pol »

Hello,

I'd like to build an hierarchical master detail report. The master should be hierarchical, the detail should indent with the master. I did this by first creating a hierarchical band with some fields and adding a container on it with a databand.

This works file, but as the hierarchical band indents, the container indents with it, over the right border of the page. How can I make the container and its contents autoschrink to the max width of the parent hierarchical band.

Jacco
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Hierarchical master detail

Post by Edward »

Please do as follows:

- Place a hierarchical band with zero height before your hierarchical band. All properties ofthis bands must be the same (except height).

- Declare a double type variable Dist in the Dictionary.

- In the new Hierarchical Band write the following EvenHandlers:

BeforePrintEvent:

Code: Select all

int level = (sender as StiHierarchicalBand).DataSource.GetLevel();
if (level > 0)
{
  if (level * this.Unit.ConvertFromHInches((sender as StiHierarchicalBand).Indent) > Dist)
  {
	  Dist = level * this.Unit.ConvertFromHInches((sender as StiHierarchicalBand).Indent);
  }
}
EndRenderEvent:

Code: Select all

Container1.Width = Container1.Width - Dist;
TextInsideTheContainer.Width = TextInsideTheContainer.Width - Dist;
You can open the attached report in the Demo example application from the standard delivery and see all that in action.

Thank you.
Attachments
52.HierarchicalBandIndentControl.mrt
(22.34 KiB) Downloaded 237 times
Post Reply