Paradox formatted memos in Delphi applications

Submitted by Frederic Marand on

Earlier today, someone asked how to display the contents of Paradox formatted memo fields in a Delphi app.

I setup a basic solution, for which the source is given hereunder.

The idea is to define a calculated String field for the Query or Database used. Say be call it FMT in a table TBL, so its object name will be TBLFMT. In the OnGetText event for the field, add this code:

{ This is the header created by Delphi }
procedure TForm1.TBLFMTGetText(Sender: TField; var Text: OpenString;
  DisplayText: Boolean);

var     s       : TMemoryStream ;
        cs      : PChar ;

s := TMemoryStream.Create ;
TBLChamp2.SaveToStream (s) ;
cs := s.Memory ;
Text := StrPas (cs + 44) ;
s.Clear ;

And that's all there is to it: your TBLFMT can now be used in any DB control and display in ASCII form the contents of your Paradox formated field.

One glitch that I noticed, however: collating sequences are not taken into account, so, depending of the collating sequence actually used in your application, you may not see non-ASCII characters properly. Just add a transliteration step if this is a problem.

If anyone uses this, has comments or a better idea, please write me about it at OSInet

Originally posted to to comp.lang.pascal.delphi.databases on 1997/03/08?