Page 1 of 1

Changing font in all StiText objects

Posted: Mon Oct 23, 2006 4:42 am
by adamjoch
Greetings.
I have a problem recognizing how to address all the StiText objects in a report. I managed as far as getting the components from the report page like this:
StiComponentsCollection compColl = TimesReport.Pages["Page1"].GetComponents();
foreach (StiComponent comp in compColl)
{
}

Now how should I proceed in detecting all the StiText components in order to change the Font property, discarding all other objects?

Thanks
Adam Jochelson

Changing font in all StiText objects

Posted: Mon Oct 23, 2006 7:41 am
by Edward
adamjoch wrote:Greetings.
I have a problem recognizing how to address all the StiText objects in a report. I managed as far as getting the components from the report page like this:
StiComponentsCollection compColl = TimesReport.Pages["Page1"].GetComponents();
foreach (StiComponent comp in compColl)
{
}

Now how should I proceed in detecting all the StiText components in order to change the Font property, discarding all other objects?

Thanks
Adam Jochelson
You should add the following lines to your code:

Code: Select all

if (comp is Stimulsoft.Report.Components.StiText) 
{
   (comp as Stimulsoft.Report.Components.StiText).Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); 
}
Thank you.

Changing font in all StiText objects

Posted: Mon Oct 23, 2006 7:53 am
by adamjoch
I did that and it works. That's just what I needed.

Many thanks

Changing font in all StiText objects

Posted: Mon Oct 23, 2006 7:57 am
by Edward
Please contact us any time you need help.
Thank you.