Combining Rich Edits
Hello,
I need to feed a large richedit with the information of other invisible RichEdits controls, so I need to copy formatted text from and to RichEdit controls.
The property RichEdit.Lines can not be used since it only handles plain text, a Stream also can not be used since LoadFromStream() operation replaces the previous RichEdit text.
The perfect way to solve this issue could be the use of the clipboard. Something like this:
Rich3.RichEdit.SelectAll;
Rich3.RichEdit.CopyToClipboard;
Rich6.RichEdit.PasteFromClipboard;
But unfortunately Fast Report does not handle the methods SelectAll, CopyToClipboard and PasteFromClipboard wich exist in Delphi RichEdit control.
Any thoughts.
TIA
Ignacio Ortiz
I need to feed a large richedit with the information of other invisible RichEdits controls, so I need to copy formatted text from and to RichEdit controls.
The property RichEdit.Lines can not be used since it only handles plain text, a Stream also can not be used since LoadFromStream() operation replaces the previous RichEdit text.
The perfect way to solve this issue could be the use of the clipboard. Something like this:
Rich3.RichEdit.SelectAll;
Rich3.RichEdit.CopyToClipboard;
Rich6.RichEdit.PasteFromClipboard;
But unfortunately Fast Report does not handle the methods SelectAll, CopyToClipboard and PasteFromClipboard wich exist in Delphi RichEdit control.
Any thoughts.
TIA
Ignacio Ortiz
Comments
1. Create a stream
2. Save to the stream contents of RichEdit1
3. Save (add) to this stream contens of other unvisible RichEdits
4. Load from this stream into your RichEdit1
Mick
Hi Mick,
Thank you for your suggestion. But I'm afraid it does not work, the (add) to stream hides the previous RichEdit information. I believe is because that each add on the stream stores the complete richedit document information (start, fonts, end, etc.) and this indeed resets the richedit control.
Regards,
Rich2.Assign( Rich1)
and then set bounds of Rich2 properly.
Mick
If it is, just find the contents between the 'start' and 'end' tags, concatenate them together and put in one final richtext.
(that's what I used to do when I first wanted to merge 2 or more fastreports files)
You can save your RichEdit text to a file (or use Wordpad to save something in rtf file) and then open it with eg. Notepad to see the structure of that kind of file. You may see only bushes over there. I tried to concatenate two long binary fields in my database which hold rtf files. But it gave no succes [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> In my opinion you should: 1a. Search the Net for[/img] technical documentation of rtf files format as Anu de Deus suggests
1b. Ask Google about -> concatenate rtf files (I found lots of links a while ago)
2. If you find something fine, then write your own function that will merge RichEdits using files or variables
3. LoadFromFile(Stream) such a merged file.
Yes I know using files inside a report to manage components seems very strange, but it could be interesting if you do not have any other choice [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Please let us know about results of your tests - like the above or any other you've already made or will make yourself. Mick[/img]
Do your RichEdit texts can be put on a page one above another?
If so then you can manipulate TfrxRichEdit components laying them on a streched band in order that you need.
Mick