Font question

Stimulsoft Reports.NET discussion
Post Reply
EDV Gradl
Posts: 228
Joined: Sat Jun 17, 2006 9:50 am
Location: Germany

Font question

Post by EDV Gradl »

When I use this code:

Code: Select all

foreach (StiPage page in report.Pages)
{
  page.SelectAll();
  page.SetFont(font);
}
all fonts are set the size and style (bold, etc.)

I'd like to change only the font, but not the size and the style.

How do I do that in code?

Thanks a lot!

Marco
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Font question

Post by Vital »

Please use following code:

Code: Select all

StiComponentsCollection comps = report.GetComponents();
foreach (StiComponent comp in comps)
{
	IStiFont font = comp as IStiFont;
	if (font != null)
	{
		font.Font = new Font(
				newFont, 
				font.Font.Size,
				font.Font.Style, 
				font.Font.Unit, 
				font.Font.GdiCharSet, 
				font.Font.GdiVerticalFont);
	}
}

Thank you.
Post Reply