In Visual Studio 2005, how can I load a font from a file and use it on a RDLC report?
I know how to load a font from a file thanks to this question, but i'm not able to use it in a RDLC report.
In Visual Studio 2005, how can I load a font from a file and use it on a RDLC report?
I know how to load a font from a file thanks to this question, but i'm not able to use it in a RDLC report.
It seems that the only way is to install the font on windows and use it like any other font available on system.
If you only need the font for a heading or two, or for a barcode column then you can make a column on the dataset of Image type, and premake the images as text to bitmaps
// From dreaming in code
/// <summary>
/// Function for converting text to a Bitmap object
/// </summary>
/// <param name="width">Width of the image</param>
/// <param name="height">Height of the image</param>
/// <param name="str">String to be converted</param>
/// <param name="textColor">Color we want the text</param>
/// <param name="recColor">Color we want the background</param>
/// <param name="f">Name of the font we want used</param>
/// <returns></returns>
/// <remarks></remarks>
public Bitmap ConvertTextToBitmap(ref int width, ref int height, ref string str, ref Color textColor, ref Brush recColor, ref string fontName)
{
using (Bitmap bmp = new Bitmap(width, height))
{
using (Graphics gfx = Graphics.FromImage((Image)bmp))
{
gfx.SmoothingMode = SmoothingMode.AntiAlias;
Font font = new Font(fontName, 11, FontStyle.Regular, GraphicsUnit.Pixel);
gfx.FillRectangle(Brushes.Transparent, new Rectangle(0, 0, bmp.Width, bmp.Height));
gfx.FillRectangle(recColor, 0, 0, width, height);
gfx.DrawString(str, font, new SolidBrush(textColor), 2, 3);
bmp.Save(Application.StartupPath + "\\" + str + ".bmp", ImageFormat.Bmp);
return bmp;
}
}
}
You could also make a Custom Report Item to replace the default textbox etc, but from all experiences these are a big PITA