TDBAdvGrid cell don't show RTF text correctly

I have a Firebird field of type BLOB SUB_TYPE = 0 to contain RTF text. I edit it with a TDBAdvRichEditor.

My problem is that I can't make the RTF text appear in a cell of a TDBAdvGrid (with ShowMemoFields = True and column editor = edRichEdit), the RTF code appears ("{\ rtf1 \ ansi \ deff0 {\ fonttbl { \ f0 \ fnil \ fcharset0 Open Sans;}}**\ viewkind4 \ uc1 \ pard \ lang3082 \ f0 \ fs24 TPF0 \ line TStateSaver \ '00 '12SaveState.Pr ... "), not the text ..

(Note: If I change the BLOB SUB_TYPE to 1, the TDBAdvRichEdit fails)

When the RTF is stored this way in the DB, please connect this DB field to a TDBAdvRichEditorRTFIO and then connect TDBAdvRichEditorRTFIO to TAdvRichEditor.

1 Like

I got it, as you have indicated, the correct combination is:

• BLOB type field (SUB_TYPE = 0, by default in firebird).
• TAdvRichEditor linked to DBAdvRichEditorRTFIO.
• Column in TDBAdvGrid for the BLOB field with editor = EdRichEdit.

So I get to have the RTF text in an AdvRichEditor (where I edit it) and in a column of an AdvGrid in the same form (it shows it correctly and lets me edit it as well).

It gave me errors because I was testing with 1 BLOB SUB_TYPE 0 field and another BLOB_SUBTYPE 1 at the same time, both in AdvRichEditor and in a column of a TDBAdvGrid, and there was corrupt data.

*** The DBAdvRichEditorRTFIO gives error when closing the form (it was the same with the filter, refers to the DataSet when it is destroyed) I have solved it by modifying DBAdvRichEditorRTFIO.pas:

procedure TDBAdvRichEditorRTFIO.EditModified (Sender: TObject);
if (FModifying) or (FDataLink.DataSet = nil) then // Ansel 11-10-21
// if (FModifying) then

(I have tried to free the AdvRichEditor and the DBAdvRichEditorRTFIO, but sometimes it gives errors, I don't know why:

procedure TProyectosF.FormClose (Sender: TObject; var Action: TCloseAction);
AdvRichEditor1.Free; //error sometimes if i do this first
DBAdvRichEditorRTFIO1.Free; // if i do this first always error

Thanks a lot.

As confirmed in other thread, improvement will be included in next update.

1 Like