Hello Sergey,
in my Database, i have saved Text with RTF-Style and now i want insert the Text (with "InsertText(W!?)) from Database into TRichViewEdit.
The Problem is, the Text is not in the RTF-Style assort the Text is in Plantext with all character.
Sample:
That is what we want
H2O
That is what we get with InsertText
H\n6 2\up0 O
Can you help me?
Thanks!
InsertText with RTF Style
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If this is a RTF fragment, you can make a valid RTF from it (by adding {\rtf1 and }:
save to stream and insert using InsertRTFFromStreamEd.
I can make an example, if you want.
However, is this really RTF? What does '\n6' mean?
Code: Select all
{\rtf1 H\n6 2\up0 O}
I can make an example, if you want.
However, is this really RTF? What does '\n6' mean?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
uses RVTypes;
var s: TRVAnsiString;
Stream: TMemoryStream;
begin
s := '{\rtf1 {\fonttbl{\f0 Times New Roman}}Hello \b world!}';
Stream := TMemoryStream.Create;
Stream.WriteBuffer(PRVAnsiChar(s)^, Length(s));
Stream.Position := 0;
RichViewEdit1.InsertRTFFromStreamEd(Stream);
Stream.Free;
end;
It will be changed in the next update: if no fonts is specified in RTF, TRichView will use the font name and charset from RVStyle.TextStyles[0], other properties will be read from RTF (or will be set to defaults for RTF font).