RTF in Access: Lebans RTF2 export issue

B

Bas van der Doorn

Hello,

I am trying to get Rich Text into and out of Access XP. The problem is that
with Lebans RTF2 ActiveX control I can input and edit Rich Text and a form
and show it on a report. But when exporting it to RTF or publishing it to
Word it breaks. Word does not show any of the Rich Text. Exporting the Rich
Text field itself (with markup code) does not work either (Word shows the
markup as plain text). Can anybody help me?

Thanks and best regards,

Bas
 
S

Stephen Lebans

Did you even bother to look on the RTF2 Web page before you directly
emailed me?

http://www.lebans.com/richtext.htm#How can I copy the contents
%20of%20the%20RTF%20control%20to%20Microsoft%20Word
How can I copy the contents of the RTF control to Microsoft Word

The simplest method is to highlight the desired text, Right Click to get
the Context Menu to appear, select Copy from the menu. You now have the
contents copied to the Clipboard. At this point you can open MS Word and
then Paste the contents of the clipboard into your Word document.

If you need to programmatically insert your RTF data into a MS Word
document(s) here are two solutions:

a) Have both Access and Word open. Open an Access form that contains an
RTF2 control bound to your RTF data field. Using Automation with the
open Word application, you could loop through the recordset, copy the
contents of the RTF2 control to the Clipboard as outlined above, and
finally paste the contents of the clipboard into the open Word document
at the desired insertion points.

b) This method does not require that you use Access at all as long as
you can access the MDB from Word that contains the RTF data. We can
programmatically copy the raw RTF string data to the Clipboard as RTF
data. Here's some code that will work in Access or Word.

Copy/GetRTFfromClipboard



--

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

Bas van der Doorn

I really did look at your website, but I only saw the newsgroup just one
minute after I emailed you (totaly overlooked it, sorry). The sourcecode for
copying to the clipboard looks nice, but I do not see how to use it in my
situation. I need to generate a report with answers to questions and
conclusions gathered from multiple records in a table. All this should have
a certain layout that can change in the future (and it contains multiple
chapters with multiple paragraphs each). Using the code would mean
hardcoding how this report would look like, which only a programmer with RTF
knowledge could change. What I would like to do is give my co-workers the
possibility to edit the report layout like any Access report. I am not
really into custom controls in Access, but some of my collegues do not know
any programming. The database I am creating should remain somewhat adaptable
in both looks and contents after I leave the company. I hope you are not
angry with me for not stating my problem clearly enough the first time.
Could you please let me know if there is any way to automatically generate
such a report while keeping the required (re)programming to a minimum in the
future?
Note: I did see that Access escapes all RTF control characters ( e.g. \{ )
when outputting the RTF strings directly on the report as a textfield. If
this could be avoided, only the {\rtf1......} section would have to be
stripped in order to generate the correct RTF output from a report. The
problem is I have no idea where something like this could be changed/fixed.

Thank you very much for any help you could give me,

Bas
 

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