TRichViewEdit. Modify bold only
TRichViewEdit. Modify bold only
Hello,
I have a TRichViewEdit control and I retrieve the rich text through a TStringStream.
var lRTF: TStringStream;
begin
lRTF := TStringStream.Create('');
try
Editor.SaveRTFToStream( lRTF, False );
Result := lRTF.DataString;
finally
lRTF.Free;
end;
If I only make the text bold, the text is not modified.
Another example, modifying only the size of a table.
Is there any TRichViewEdit option to apply those modifications?
a greeting
I have a TRichViewEdit control and I retrieve the rich text through a TStringStream.
var lRTF: TStringStream;
begin
lRTF := TStringStream.Create('');
try
Editor.SaveRTFToStream( lRTF, False );
Result := lRTF.DataString;
finally
lRTF.Free;
end;
If I only make the text bold, the text is not modified.
Another example, modifying only the size of a table.
Is there any TRichViewEdit option to apply those modifications?
a greeting
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: TRichViewEdit. Modify bold only
Sorry, I do not understand the question.
Of course, there are many operations for modifying properties of font, paragraphs and objects that do not affect text content.
However, if you save text as RTF, RTF will be different because RTF is not just a plain text, it contains information about text and table properties.
I do not understand, how do you want to apply these changes?
In Editor? or in the resulting RTF string?
Of course, there are many operations for modifying properties of font, paragraphs and objects that do not affect text content.
However, if you save text as RTF, RTF will be different because RTF is not just a plain text, it contains information about text and table properties.
I do not understand, how do you want to apply these changes?
In Editor? or in the resulting RTF string?
Re: TRichViewEdit. Modify bold only
I edit a text
Set as bold text
When i save RTF text into TStringStream, the text is not modified:
Editor is TRichViewEdit
If i set as bold text and add a new character its ok. Like this
Set as bold text
When i save RTF text into TStringStream, the text is not modified:
Code: Select all
function TfEditorRV.TextoRTF: string;
var lRTF: TStringStream;
begin
lRTF := TStringStream.Create('');
try
Editor.SaveRTFToStream( lRTF, False );
Result := lRTF.DataString;
finally
lRTF.Free;
end;
end;
If i set as bold text and add a new character its ok. Like this
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: TRichViewEdit. Modify bold only
Sorry, what do you mean?When i save RTF text into TStringStream, the text is not modified:
Where is the text not modified? in Editor? In RTF string?
Re: TRichViewEdit. Modify bold only
1. I put the original text in Editor.
2. With the Editor, I only put the text in bold
3. Using the method SaveRTFToStream( TStringStream, Boolean) from Editor. The text recovered have the origal texto
"lRTF.DataString" has the original text
If in addition to making the text bold, I add a character, the RTF text contain the change to bold
2. With the Editor, I only put the text in bold
3. Using the method SaveRTFToStream( TStringStream, Boolean) from Editor. The text recovered have the origal texto
Code: Select all
function TfEditorRV.TextoRTF: string;
var lRTF: TStringStream;
begin
lRTF := TStringStream.Create('');
try
Editor.SaveRTFToStream( lRTF, False );
Result := lRTF.DataString;
finally
lRTF.Free;
end;
end;
If in addition to making the text bold, I add a character, the RTF text contain the change to bold
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: TRichViewEdit. Modify bold only
Do you mean that RTF saved at step 3 has non-bold text?
Can you create a simple project to reproduce this problem?
Can you create a simple project to reproduce this problem?
Re: TRichViewEdit. Modify bold only
I tried this and it seems to be working. I'm changing the bold this way:
Then, using your function:
And this on a button:
The RTF code returned by the TexttoRTF function is correct as I set or unset bold and click the button that runs the function. When I set the text to bold I see \b in the returned RTF. When I unbold it, the \b goes away in the returned RTF.
Code: Select all
procedure TForm1.ToggleBold;
begin
if rve.GetItemStyle(rve.CurItemNo) <> 1 then
rve.ApplyTextStyle(1)
else
rve.ApplyTextStyle(0);
rve.Reformat;
end;
Code: Select all
function TextoRTF: string;
var lRTF: TStringStream;
begin
lRTF := TStringStream.Create('');
try
form1.rve.SaveRTFToStream( lRTF, False );
Result := lRTF.DataString;
finally
lRTF.Free;
end;
end;
Code: Select all
procedure TForm1.Button4Click(Sender: TObject);
begin
ShowMessage(TextoRTF);
end;
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: TRichViewEdit. Modify bold only
So, is the problem solved?
Re: TRichViewEdit. Modify bold only
My post above was just some test code to try and help the original poster. Not sure if what I tried will help him or not. Stan
Re: TRichViewEdit. Modify bold only
My mistake, it works fine.
Sorry
Sorry