Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Setting font in a dbrichtext field

edited March 2006 in General
I'm having a problem setting the font in a dbrichtext field. I need
to set any text in the field to the same font. So following demo29 I
have the following code in the ppDBRichText's onprint event:

.. ppDBRichText1Print(Sender: TObject);
begin

ppdbrichtext1.SelectAll;

ppdbrichtext1.SelAttributes.assign(Default_Font);

end;


When the form is created I define Default_font as follows:

Default_Font := Tfont.Create;
Default_Font.Name := 'Arial';
Default_Font.Size := 8;


But what prints is the original font. What am I doing wrong?

I'm using D7 and RB 9.03

Thanks

Craig

Comments

  • edited March 2006
    Hi Craig,

    In order to alter the RichText component as you need, you will need to use a
    TppRichText object rather than a TppDBRichText. Notice in the example, at
    the top of the OnPrint event the text is manually assigned using the
    following code...

    ppRichText1.RichText := tblBioLife.FieldByName('Common_Name').AsString + #13
    + #13 + tblBioLife.FieldByName('Notes').AsString;

    Try switching to a TppRichText component and see if that helps.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2006
    Thanks -- switching to the tpprichtext worked. Guess I just assummed
    that the dbrichtext would work the same as the non db guy.

    Ta

    On Fri, 10 Mar 2006 07:59:36 -0700, "Nico Cizik \(Digital Metaphors\)"
This discussion has been closed.