Convert the font of a Rich Object

Hello,


our Systems uses FastReport as Report Engine.


In a Contract there are many positions, stored in SQL-Database and represented on report as rich object.


I know that these texts are formatted in SQL-Database already.


But our software producer is not able to format these texts in our company standard.


I only want to change the font-family and font-size. Is that possible?

Comments

  • Hello!

    Yes, you can standardize the RTF font family and size right before printing in RichObject using the BeforePrint event via a temporary System.Windows.Forms.RichTextBox:

    private void Rich1_BeforePrint(object sender, EventArgs e)
    {
    var rich = (RichObject)sender;
    using (var rtb = new System.Windows.Forms.RichTextBox())
    {
    rtb.Rtf = rich.Text;
    rtb.SelectAll();
    rtb.SelectionFont = new Font(“Calibri”, 10f);
    rich.Text = rtb.Rtf;
    }
    }
    
This discussion has been closed.