Changing font in all StiText objects

Stimulsoft Reports.NET discussion
Post Reply
adamjoch
Posts: 2
Joined: Mon Oct 23, 2006 4:37 am
Location: Solna

Changing font in all StiText objects

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

Changing font in all StiText objects

Post 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.
adamjoch
Posts: 2
Joined: Mon Oct 23, 2006 4:37 am
Location: Solna

Changing font in all StiText objects

Post by adamjoch »

I did that and it works. That's just what I needed.

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

Changing font in all StiText objects

Post by Edward »

Please contact us any time you need help.
Thank you.
Post Reply