I have a problem when using RVEdit imbedded in a form. I set a RTF text for example (test written in red font color):
Code: Select all
'{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}'#$D#$A#$D#$A'\uc0'#$D#$A'\pard\fi0\li0\ql\ri0\sb0\sa0\itap0 \plain \f0\fs20\cf6 test}'
Code: Select all
procedure TCustomRichViewEdit.SetText(sText: string);
var
rtfStream : TStringStream;
begin
rtfStream := TStringStream.Create(sText);
Self.Clear;
Self.LoadFromStream(rtfStream, rvynaNo);
Self.Format;
Self.Modified := false;
rtfStream.Free;
end;
Code: Select all
function TCustomRichViewEdit.GetText: string;
var
rtfStream : TMemoryStream;
rtfBuffer : string;
tesbegin
begin
rtfStream := TMemoryStream.Create();
rtfBuffer := '';
try
Self.SaveRTFToStream(rtfStream, false);
rtfStream.Position := 0;
SetLength(rtfBuffer, rtfStream.Size);
rtfStream.ReadBuffer(Pointer(rtfBuffer)^, rtfStream.Size);
Result := rtfBuffer;
finally
rtfStream.Free;
end;
end
end;
Code: Select all
'{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}'#$D#$A#$D#$A'\uc1'#$D#$A'\pard\fi0\li0\ql\ri0\sb0\sa0\itap0 \plain \f0\fs20 test}'
I also have a question about the section '#$D#$A#$D#$A'\uc1'#$D#$A' in the RTF. When I save the RTF and open it in Word the example above is translated with '#$D#$A#$D#$A'\uc1'#$D#$A' test.
Any suggestions of how I can change my code to make it work?
Thanks!