Vertical Positioning of RTF Controls

Stimulsoft Reports.NET discussion
Post Reply
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

Vertical Positioning of RTF Controls

Post by shmuly »

I am trying to center a rich text box vertically withing a page. Is there a way to accomplish this?
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

Vertical Positioning of RTF Controls

Post 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).
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Vertical Positioning of RTF Controls

Post 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.
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

Vertical Positioning of RTF Controls

Post by shmuly »

Neither of these options give me the ability to center it vertically
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

Vertical Positioning of RTF Controls

Post by shmuly »

How would you accomplish this in this report (taken from the demo reports shipped with StimulReports
Attachments
284.Richtext.mrt
(15.79 KiB) Downloaded 323 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Vertical Positioning of RTF Controls

Post 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.
Attachments
287.Richtext_AndEndRender_Event.mrt
(16.02 KiB) Downloaded 330 times
Post Reply