Page 1 of 1

Font question

Posted: Mon Dec 03, 2007 3:00 am
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

Font question

Posted: Mon Dec 03, 2007 3:12 am
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.