Page 1 of 1

Vertical Positioning of RTF Controls

Posted: Mon Dec 07, 2009 4:34 pm
by shmuly
I am trying to center a rich text box vertically withing a page. Is there a way to accomplish this?

Vertical Positioning of RTF Controls

Posted: Mon Dec 07, 2009 5:39 pm
by shmuly
An update:

I tried to put this in the BeforePrint event:

RichText1.Top = (DataBand1.Height / 2) - (RichText1.Height /2)

The problem is that I'm getting the height of the component as it is in the designer. Not the rendered component (which resizes itself based on the content).

Vertical Positioning of RTF Controls

Posted: Tue Dec 08, 2009 2:13 am
by Edward
Hi

Is it possible to place a panel component in the Page and then to place a databand with that RichText into this Panel?

Or just to place a Richtext in the page according with requirements to centre it?

Thank you.

Vertical Positioning of RTF Controls

Posted: Tue Dec 08, 2009 9:18 am
by shmuly
Neither of these options give me the ability to center it vertically

Vertical Positioning of RTF Controls

Posted: Tue Dec 08, 2009 9:21 am
by shmuly
How would you accomplish this in this report (taken from the demo reports shipped with StimulReports

Vertical Positioning of RTF Controls

Posted: Wed Dec 09, 2009 4:13 am
by Edward
Hi

Thank you for the sample report. It helped as always to understand your task :)

Please add the following code for this attached report into EndRender event of the report object.

For this select 'Report' object in the 'Properties' window in the Designer and add the following code there:

foreach (StiPage page in this.RenderedPages)

Code: Select all

{
	foreach (StiComponent comp in page.Components)
	{
		if (comp.Name == "RichText1")
		{
			comp.Top = page.Height/2-comp.Height/2;
		}
	}
}  
Thank you.