Re:Can't view a Formated Memo (RTF) Field in ReportSmith ... HELP PLEASE!!
Quote
"ADRIAN WREYFORD" <wreyf...@icon.co.za> wrote:
>I just can't get ReportSmith to show the contents of a Formatted memo
>field. I can get it to show a standard memo field, just by including the
>field in the report, but when I use a formatted memo, it leaves the field
>blank in the report.
>This is a major problem, as I need to create reports that contain formatted
>memos (Paradox) pleeeeeeese help!!!
>Thanks
>Adrian
Paradox Formatted memos are not RTF ! I've setup a solution
to display them in data-aware components, but you're on your own with
RS.
Just to give you an idea, for forms, 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 ;
begin
s := TMemoryStream.Create ;
TBLChamp2.SaveToStream (s) ;
cs := s.Memory ;
Text := StrPas (cs + 44) ;
s.Clear ;
end;
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 f...@soon.com
-------------------------
Frederic G. MARAND
Agorus SA / OSI SARL
f...@soon.com
-------------------------