Hi
I have standard paragraphs stored as RTF text in a database table and would like to insert that into a WPRichText edit component - is that possible
Regards
Bobby
Hi
I have standard paragraphs stored as RTF text in a database table and would like to insert that into a WPRichText edit component - is that possible
Regards
Bobby
Sure:
WPRichText1.SelectionAsString := string_with_rtf_text_to_be_inserted;
(Use Field.AsString)
JUlian
First you need to decide where to insert it, is it going to be at the cursor position or some other pre-allocated spot?
Hi,
That's right. Using CPPosition it is possible to move the cursor position if required.
The Load methods (LoadFromStream) can also be used to insert formatted text.
Julian
Greetings,
i am using it just like this but the text gets inserted at the end of the paragraph and not where the cursor blinks. (TDBWPRichText V6)
What's the deal?
best wishes,
Wolfgang
Hi,
In a TDPWPRichText you need to make sure the database is in edit mode.
Before You start with your modification call
WPRichText1.Changing
Julian
I'll try that, thanks Julian.
best wishes, Wolfgang
edit:
sorry, does not work either.
Zitat von leprinceGreetings,
i am using it just like this but the text gets inserted at the end of the paragraph and not where the cursor blinks. (TDBWPRichText V6)
What's the deal?
best wishes,
Wolfgang
I am pretty sure that the problem is a moved cursor when the text is inserted.
Please simplify your text procedure
WP.InputString("xyz") will insert at cursor position.
WP.SelectionAsString := "xyz"; should also insert there - although internally it does something completele different (uses the ANSI reader).
So Your description off the effect is not sufficient to give better advice
Julian,
of course you are right about too less information; i suspected that you could tell the cause from a few symptoms right away ;-)
I am doing roughly this:
Destination.SelectionAsString := TdxDBGrid(Source).DataSource.DataSet.FieldByName( DataFieldTextbaustein).AsString;
where
Destination is a TDBWPRichText (CPPosition somewhere in the middle)
Source is a TObject
DataFieldTextbaustein is the name of a long varchar field in Sybase SA
The DataFieldTextbaustein contains RTF which was previously edited in a TDBWPRichText. It also contains additional mailmerge fields itself.
IMHO there is a difference whether Destination has focus or not. If i dragdrop something onto it, the insertion works well. If i do it programmatically, it fails.
best wishes,
Wolfgang