R – Displaying unicode text in Rave Reports on Delphi 2009


I am in the process of porting a Delphi 2006 app to Delphi 2009. Out of the box support for unicode has been easy – almost no work required. Most 3rd party controls already have Delphi 2009 updates available.

Rave Reports (latest version 7.6.1, available here) has also been updated, but I cannot seem to get it to correctly display RTF text containing Japanese characters. In Delphi 2006, I loaded RTF to the DataMemo component in a RVCustomConnection's OnGetRow event by reading the RTF from a screen control (TLMDRichEdit) using streams and then doing a CustomConnection.WriteBlobData.

In the report output, any RTF text now shows up as a series of rectanges and % signs. No readable text. All other text (displayed using Text and DataText components) displays correctly.

Does anyone have any experience on how to get RTF containing unicode to display correctly? Is it even supported?

Best Solution

I used this...it seemed to work with Dephi XE's built in RAVE package...

Procedure TfrmMain.RaveCustomConnectionGetRow                  (         Connection: TRvCustomConnection);
  MemoString : String;
  Index      : Integer;
  Size       : Integer;
  Buffer     : PAnsiChar;


  { Init MemoString }
  MemoString := '';

  For Index := 0 To DataList.Count - 1 Do Begin
    MemoString := MemoString + DataList.Strings [Index] + #13#10;
  End; { For }

  { Set the Size (Unicode) and Buffer }
  Size := Length (MemoString) * 2;
  Buffer := PAnsiChar (MemoString);

  { Send the data over as a Blob object to RAVE }
  Connection.WriteBlobData (Buffer^, Size);

End; { RaveCustomConnectionGetRow Procedure }