Specify default font for report

Stimulsoft Reports.NET discussion
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Specify default font for report

Post by IanMcCarthy »

On my PC a report previews OK, a series of text boxes displaying descriptions & values.
In the designer the text boxes show the font as Arial 8pt normal. (Good)

On another PC the user has changed some of the Windows fonts to bold.
On this PC the text boxes also display values in bold. (Bad)

Can I pre-set the default document font to cure this?

Or will I have to pre-set each text box in the document individually?

Many thanks,

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

Specify default font for report

Post by Vital »

You can use following code:

Code: Select all

foreach (StiPage page in report.Pages)
{
  page.SelectAll();
  page.SetFont(font);
}
Thank you.
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Specify default font for report

Post by IanMcCarthy »

I've just had some further information about this:

It appears the user had changed the dpi setting of his monitor from 96 to 120 (rather than changing the font selection as I originally thought).

This made all the text appear bigger (it looked like bold).

Just something to watch out for...

Many thanks for your splendid support.

Ian
ChristianH
Posts: 43
Joined: Fri May 25, 2007 2:54 am
Location: Austria

Specify default font for report

Post by ChristianH »

I´m facing the same problem.
Reports are designed for monitors set to 96 dpi. On monitors with 120 dpi everything becomes bigger....

Is there an easy solution ? I´m searching for a switch like "use 96dpi setting" or something like this... ;-)
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Specify default font for report

Post by Vital »

We need time for investigation of this problem. We will inform you about progress in this topic.

Thank you.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Specify default font for report

Post by Vital »

Try to use following method:

Code: Select all

private void ChangeFontSize(StiReport report)
		{
			StiComponentsCollection comps = report.GetComponents();
			foreach (StiComponent comp in comps)
			{
				IStiFont font = comp as IStiFont;
				if (font != null)
				{
					font.Font = Stimulsoft.Base.Drawing.StiFontUtils.ChangeFontSize(font.Font, font.Font.Size * 96 / 120);
				}
			}
		}
Thank you.
ChristianH
Posts: 43
Joined: Fri May 25, 2007 2:54 am
Location: Austria

Specify default font for report

Post by ChristianH »

This is a solution, indeed.
Thanks !
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Specify default font for report

Post by mmurdock »

Where do you put this? Is it in the report or do you put it in your app?

Thanks,

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

Specify default font for report

Post by Vital »

You can put this method in report code or in application.

Thank you.
René van den Berg
Posts: 24
Joined: Mon Jul 17, 2006 12:41 am
Location: Holland

Specify default font for report

Post by René van den Berg »

Hi,

I'm having problems with DPI settings of PC's of my customers as well. I have the problem that one customer is using DPI 120 and the other is using DPI 96, so I can't use the solution you suggested. Wouldn't it be better to make stimulreport independent of the DPI settings on a PC? I can't imagine that anyone thinks it is useful to scale the reportfonts as well as the screenfonts.

Greetings,
René van den Berg
Egosoft B.V.
Post Reply