Sorry for my english...
I want to extract a text-only fragment from a certain position in a RTF (any number of items), change this text, and put it back.
2 questions:
1. How can I know that in TRichViewEdit it's a difference between:
Text1 [Objects] Text2
and
Text1 [Objects]
Text2
In a normal text the difference is #13#10 in Windows and #13 in Linux.
I ask because the final text will be in the first case "Text1 Text2" and in the second case "Text1#13#10Text2".
2. What function could I use to keep the format of the text in sync with my modifications?
Example:
"Hello [bold]world[nobold]" >> "Hi [bold]world[nobold]".
Thanks for your reply...
Extract block text and put it back
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
In TRichView, document consists of items (text items, pictures, etc.). Items are indexed from 0 to rv.ItemCount-1.
If the i-th item starts a new line, rv.IsFromNewLine(i) returns True.
To keep text attributes, copy fragment either in RTF or (better) in RVF format. Other objects in the fragment (such as pictures) will be copied too.
(SaveRVFToStream(..., True), LoadRVFFromStream in another RichView, modify, copy it back).
But may be you can modify text directly in the source control (using SetItemTextEd or SetItemText)
If the i-th item starts a new line, rv.IsFromNewLine(i) returns True.
To keep text attributes, copy fragment either in RTF or (better) in RVF format. Other objects in the fragment (such as pictures) will be copied too.
(SaveRVFToStream(..., True), LoadRVFFromStream in another RichView, modify, copy it back).
But may be you can modify text directly in the source control (using SetItemTextEd or SetItemText)