Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insterting formatted text into MS Word

Status
Not open for further replies.

seagoing

Programmer
Jun 1, 2003
61
GB
Essentially, I have a mail merge app. I use Access 2000 to enter text which is later used to produce personalised letters in MS Word 2000 using a master word template that has appropriate doc properties and field codes defined.

It currently works fine as is. However, I wish to enhance the application so I can format the text I enter in Access 2000 as rtf/html, and there are some well known ActiveX controls that will allow me to do this. But, whilst inserting unformatted text into my MS Word documents works fine, to date I have NOT found any method of inserting/pasting formatted (rtf/html) text directly into MS Word during my mail merge process.

Could anyone confirm if this is possible (preferably without the need for intermediate/temporary files) and if so, how its done? I'd be most grateful if someone could enlighten me about this

Regards
TS
 
I used to build letters to a text file from Access using HTML. I then used Word's Insert File for the final result. HTML's Class works out as Tags in Word.
 
Thanks for that Remou. However, it uses a temporary file which is the one method I was trying to avoid.
I'm sure someone out there must know a more direct way of inserting formatted text directly into word.
 
Have you tried creating a style that duplicates your desired format? Insert your text and assigned that style to it.

Gerry
 
Creating a style? No I've not tried that 'coz, presumably, it would apply to all my inserted text. What I'm after is to be able to format words, and/or phrases, in the text. for example Bold or italisize certain words, change the colour of certain words and/or phrases, permit the inclusion of ordered and unordered lists, etc.
 
presumably, it would apply to all my inserted text
Why would you presume that? It could apply to whatever you wanted it to apply to. Word is not going to automatically apply it. YOU apply it - so you can do whatever you want with it.

Every thing you mention can be done using character styles.

Gerry
 
OK, how exactly? As I understand, the only way I can get my users to enter and format the text for later insertion into word, in my mail merge process, is to provide the user a Rich Text/HTML editor control for use in access. How would this relate to any styles that maybe defined in word? So far, I've tried posting text, rtf and html directly into the appropriate place in my word document, but whatever I insert is shown as text, that is, I've been unable to discover a way to get word to interpret iether the rtf or html codes, which end up being show as text aswell?

 
It may be helpful to describe your process.

In your last post you mention:
What I'm after is to be able to format words, and/or phrases, in the text. for example Bold or italisize certain words, change the colour of certain words
This can be done with character styles, no problem. You look for the appropriate text - using logic of some sort - and apply the style. However, this sounds like post merge processing.

Gerry
 
I'm sorry, I thought I had!
There is NO post merge processing.
The user is entering the textual content into an Access database, this content is LATER to be merged into personalised Word documents.
The user needs to be able to format the text they enter, into the Access database, as described previously, as they see fit, at the time it is entered.
My problem is how to insert this formatted text into the word document so that word interpets these rtf or html codes rather than displaying them as part of the inserted text.

Remou's previous suggestion of using a temp file and inserting a file include for it, into to worddocument, does work, but I'm looking for a way to do it directly, without the need for a temporary file.

TS
 
No can do. The format of text in Word is ALWAYS taken from the style of either the characters (characters styles) or the whole paragraph (paragraph styles). It can of course also be manually formatted. Although technically, in later versions Word makes new styles for manually formatted text...ugh, ugh, bleeck... stupid, hate it. But in any case, as you have found out it will not take the format of the RTF or HTML into the Word document. As I mentioned it would be possible to do this as post merge processing, but if that does not work for you...then it does not work.

Gerry
 
OK fumei, thanks. Guess I'll have to go the way of using a temporary file and an include!. I appreciate your responses.
 
fumei said:
Although technically, in later versions Word makes new styles for manually formatted text...ugh, ugh, bleeck... stupid, hate it.

Word does not make new styles. What it does by default is show all formatting - not just styles - in the Styles and Formatting Task Pane. You can change this by selecting a different option from the "Show" dropdown at the bottom. You can tell which entries in the Task Pane are Styles (and of which type) by the icon to the right and which are manual formatting by the absence of an icon.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Ah....true. I always forget that when I see someone's computer with gobs and gobs of listings in what I think of as an exclusively style dropdown. Thanks Tony. Duly noted. Or rather, remembered.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top