Hi,
I have a RichViewEditor and a local variable rveText : string;
How can I put the text or the rtf in this variable ?
I didn't find any RichViewEditor.gettext or other ..
Thanks !
Get text/rtf in local variable
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
As for plain text - you can use GetAllText from RVGetTextW unit (if you need Unicode string result) or from RVGetText unit (if you need ANSI text)
As for RTF string:
As for RTF string:
Code: Select all
uses RVTypes;
function GetRTFString(rv: TCustomRichView): String;
var Stream: TMemoryStream;
s: TRVAnsiString;
begin
Stream := TMemoryStream.Create;
rv.SaveRTFToStream(Stream, False);
Stream.Position := 0;
SetLength(s, Stream.Size);
Stream.ReadBuffer(PRVAnsiChar(s)^, Length(s));
Stream.Free;
Result := String(s);
end;
Get RTF text
Hello...
i'm trying to use this function, but the result is not as i need.
Into my RTF text the word "PARÓQUIA" is "PAR\u211 \'d3QUIA"
It is unicode characters ?
Can i get the RTF without them ?
Thanks!
i'm trying to use this function, but the result is not as i need.
Into my RTF text the word "PARÓQUIA" is "PAR\u211 \'d3QUIA"
It is unicode characters ?
Can i get the RTF without them ?
Thanks!
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Sorry, you cannot.
TRichView always saves Unicode characters having codes greater than 127 as RTF Unicode characters.
You can only remove non-Unicode duplicates of characters (\'d3 in you example), exclude rvrtfDuplicateUnicode from RTFOptions properties.
Saving Unicode characters as Unicode characters in RTF is necessary.
If we would save only non-Unicode duplicate (\'d3), it can be read correctly only if its Charset is specified correctly. It is not necessary so in TRichView Unicode documents.
And RTF specification does not allow saving characters having codes greater than 127 as they are.
TRichView always saves Unicode characters having codes greater than 127 as RTF Unicode characters.
You can only remove non-Unicode duplicates of characters (\'d3 in you example), exclude rvrtfDuplicateUnicode from RTFOptions properties.
Saving Unicode characters as Unicode characters in RTF is necessary.
If we would save only non-Unicode duplicate (\'d3), it can be read correctly only if its Charset is specified correctly. It is not necessary so in TRichView Unicode documents.
And RTF specification does not allow saving characters having codes greater than 127 as they are.
RTF Documentos
OK, thanks for your attention