Set FontStyle of TextObject in Script of report

Hi I am tring to set the Font to Bold of a TextObject in the Fast Reports Script section, thought this would work but it returns a ReadOnly exception when running the report:

if(Blah < = 0)
{
TextObject.Font.Style = FontStyle.Bold;
}

tried this as well: txtChildAsset.Font.Bold = true;

same result

How do I set this textobject to Bold ?

Comments

  • edited 9:24PM
    shanewiso wrote: »
    Hi I am tring to set the Font to Bold of a TextObject in the Fast Reports Script section, thought this would work but it returns a ReadOnly exception when running the report:

    if(Blah < = 0)
    {
    TextObject.Font.Style = FontStyle.Bold;
    }

    tried this as well: txtChildAsset.Font.Bold = true;

    same result

    How do I set this textobject to Bold ?

    Font Object are a little bit strange in .NET you need to recreate the font based on the current font with a new style
    TextObject.Font = new Font(TextObject.Font, FontStyle.Bold);
    

    regards
    Ingo

Leave a Comment