/// <summary>
/// Converts a report style to a new font definition.
/// </summary>
/// <param name="reportStyle">The report style.</param>
/// <param name="fontFamily">Name of the font.</param>
/// <returns>The font.</returns>
public static Font ConvertStyleToFont(ReportStyle reportStyle, string fontFamily)
{
var font = new Font();
font.SetFamily(fontFamily);
if (reportStyle.Underline)
{
font.SetStyle(Font.UNDERLINE);
}
else if (reportStyle.Bold || reportStyle.Italic)
{
if (reportStyle.Bold && reportStyle.Italic)
{
font.SetStyle(Font.BOLDITALIC);
}
else if (reportStyle.Bold)
{
font.SetStyle(Font.BOLD);
}
else
{
font.SetStyle(Font.ITALIC);
}
}
font.Size = reportStyle.FontSize;
font.SetColor(reportStyle.ForeColor.R, reportStyle.ForeColor.G, reportStyle.ForeColor.B);
return(font);
}