[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.SectionReport.FontResolver

FontResolver Property

FontResolver

Gets or sets the font resolver.

Declaration
[Browsable(false)]
public IFontResolver FontResolver { get; set; }
Property Value
Type Description
IFontResolver

An object that implements IFontResolver.

Remarks

The null value represents the default resolver.

Examples
public sealed class DirectoryFontResolver : GrapeCity.ActiveReports.IFontResolver
{
	static readonly GrapeCity.Documents.Text.FontCollection _fonts = new GrapeCity.Documents.Text.FontCollection();
	static DirectoryFontResolver()
	{
		_fonts.RegisterDirectory(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts));
		_fonts.DefaultFont = _fonts.FindFamilyName("Arial");
	}
	public static GrapeCity.ActiveReports.IFontResolver Instance = new DirectoryFontResolver();

	private DirectoryFontResolver() { }
	GrapeCity.Documents.Text.FontCollection GrapeCity.ActiveReports.IFontResolver.GetFonts(string familyName, bool isBold, bool isItalic)
	{
		var fonts = new GrapeCity.Documents.Text.FontCollection();
		var font = _fonts.FindFamilyName(familyName, isBold, isItalic);
		if (font != null) fonts.Add(font);
		fonts.Add(_fonts.DefaultFont);
		return fonts;
	}
}
void InitReport()
{
	var sectionReport = new GrapeCity.ActiveReports.SectionReport();
	sectionReport.LoadLayout(reportFilePath);
	sectionReport.Document.Printer.PrinterName = String.Empty;
	sectionReport.FontResolver = new DirectoryFontResolver();
	viewer.LoadDocument(sectionReport);
}