Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying rich text from a Word file
Message
From
17/08/2000 21:37:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Copying rich text from a Word file
Miscellaneous
Thread ID:
00406482
Message ID:
00406482
Views:
47
How do I programmatically copy rich text from a word file into an ActiveX RichText control.

Using the Richtext control example found in the Solutions suite, I can cut some rich text (having mixed formatting) from the Word document and then paste it into the rich text control in the sample form. In fact, if I simply select the text in the word document and drag it onto the Richtext control, everything works fine. But my attempts to do the same thing with automation falls flat.

I want to be able to go in the other direction, too (vfp to word). Again, if I transfer the rich text selection manually, no problem. But I don't know how to transfer it programmatically.

I've spent a lot of time in the Word VB editor, gleaning as much knowledge as I can about automation, but I still can't get what I want.

The only means I have found which seems like it ought to work (assuming I've selected some text in the word file) is to use the FormattedText property of the Range object to pick up the text with formatting. Problem is that this produces a range object which isn't quite what the TextRTF property of the Richtext control is looking for. So, for example, the following snippet does not work:
oRTFcontrol.textrtf = oWordapp.selection.formattedtext
The above results in a plain text string (inside of a richtext wrapper). IOW - all of the formatting on the individual substrings of the rich text selection have been lost. I'd be perfectly happy to just progammatically cut the text from the word file, then paste it into the rich text control, but I don't know how to Paste programmatically with VFP. (Or cut...if I want to go the other direction).

My forhead is now quite flat (from wall-banging). Any ideas?
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Next
Reply
Map
View

Click here to load this message in the networking platform