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

Changing a ppDBRichText Font at Run-time

edited February 2003 in General
I asked this a while back and Jim was very helpful but I don't think I ever
got it to work right. I want to reformat a RichText database field at
run-time to set to a standard font on the form.

This is my ppDBRichText.OnGetRichText() event:

procedure TfAPTEdit.ppNotesGetRichText(Sender: TObject; var Text: String);
var
R : TRichEdit;
begin
R := TRichEdit.Create(Self);
R.Parent := Self;
R.Text := APT.FieldByName('Notes').AsString;
R.SelectAll;
R.SelAttributes.Size := 12;
R.SelAttributes.Name := 'Verdana';
R.SelAttributes.Style := [];
Text := R.Text;
R.Free;
end;

What am I doing wrong? The point size never seems to print correctly,
though other formatting is removed.

Thanks for any assistance.

-Johnnie

Comments

  • edited February 2003
    A better search of my old code found the solution. I use a non DB RichText
    control:

    procedure TfAPTEdit.ppNotesPrint(Sender: TObject);
    begin
    ppNotes.RichText := APT.FieldByName('Notes').AsString;
    ppNotes.SelectAll;
    ppNotes.SelAttributes.Size := 12;
    ppNotes.SelAttributes.Name := 'Verdana';
    ppNotes.SelAttributes.Style := [];
    end;

    It's always 2 minutes after I click [Send].

    -Johnnie
  • edited February 2003

This discussion has been closed.