Saving Extra Data (binary) in rvf document?

General TRichView support forum. Please post your questions here
Post Reply
softtouch
Posts: 49
Joined: Thu Sep 15, 2005 5:56 am

Saving Extra Data (binary) in rvf document?

Post by softtouch »

Is there any way to store binary data, for example audio files or whatever, inside a rvf document?
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's possible to save additional text data using DocProperties property.
And any binary data can be converted to a text form.
The simplest way - to represent each byte of data as 2 hexadecimal characters. Functions for encoding/decoding can be found in RVFuncs unit:
binary -> text
function RVFStream2TextString(Stream: TMemoryStream): String;
text -> binary
function RVFTextString2Stream(const str: String; Stream: TMemoryStream): Boolean;

More sophisticated way - using Base64 encoding. The resulting string will be not so large as if you use the first method. Functions for encoding/decoding can be found here: http://www.zeitungsjunge.de/delphi/mime/index.htm
Post Reply