Automation and RTF2 Control

F

François Uldry

Hi all,

Just in case, if you want to do it someday.

Current version of RTF2 control (1.4) does support this :

Assign RTF data to the RTFText property.

Set the SelStart property to 0.
Set the SelLength property to the len of the RTF data.
Use the copy method of the RTF2 control.

Now you have properly formatted RTF data in the clipboard that you can paste
wherever you please.

Some questions :
What happens if we set the SelStart property to a value bigger that the
length of the data in the control ?
What happens really when we put a number which is bigger than the control in
the SelLength property ?

This trick, while not documented, allows anyone to automate the creation of
a Word document from within Access with RTF data.

Without using an RTF file, which was important for me.

Thanks for your attention,
*Back to lurk*
Francois
 
S

Stephen Lebans

HiFrançois,
to answer your first question, setting the SelLength prop to a value
greater then the length of data in the control will simply select all of
the data in the control. There are no negative side effects.
As to what would happen if you set the SelStart prop to a value greather
than the length of data in the control I don't remember off the top of
my head. Why not try it and let me know. I'll add your comments to the
RTF Web page.

As for your "undocumented trick", I added the Selxxx props and the
ClipBoard Copy and Paste methods to handle several issues including
interfacing with external Programs that accept RTF.

Good luck with your project!
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top