Solved

Merging Rich Text/HTML

Posted on 2011-03-18
10
519 Views
Last Modified: 2012-05-11
I have a database that merges into docx files. This works perfectly (after much effort). Now I have a need to add a new field, but it needs to keep a certain formatting. I've added it to the database as rich text. It saves correctly (I can see the value in the field and the bold/regular and fonts are correct. However, when I merge it displays html code (<div><font face=Arial size=2 color=black><strong>  etc...).

Is there any way for me to import the format?
0
Comment
Question by:Cluskitt
  • 6
  • 4
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
First, Technically, Rich text and HTML are two different formats.

Microsoft Access 2007 and newer, calls it "Rich Text", when it is actually HTML.

The last time I researched this, there was no easy way to do what your are asking.

In other words, your system is trying to "Insert" HTML (with the formatting codes/tags) into the Rich text (actually HTML) field directly.

You cannot (as far as I know) Insert Raw HTML codes into a memo field and have it "display" formatted.
The purpose of a Rich text field in Access was to allow you to format the data once it is "in" Access.

JeffCoachman

0
 
LVL 18

Author Comment

by:Cluskitt
Comment Utility
Yes, I am aware that access saves this as HTML instead of pure rich text. However, I really need to keep different text formats. Are there any workaround? Like converting functions, either on word or access? Field formatting? Sending the field into a query, change it somehow to rich text and use that?

In short, is there _ANY_ way at all I can use a merge field that uses different text formats? Basically, it's just some words are bold and others aren't. However, they are kinda dynamic and I can't predict which and how many they are (else I would just make them bold afterwards).
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Not that I know of...
Perhaps there is something in Access 2010...?, perhaps someone here has addressed this issue in another Q?, ...perhaps there is a workarond using the webbrowser control...?

Can you explain a bit more about this "merge" you are doing?

Remember MS Access RichText (HTML) was only meant as a way for you to format plain text already in the data.

In the even larger sense, the question of whether or not "Formatted" data need be stored in a database at all is another discussion.

If the data needs to be "Formatted", then why not format it in the *output* (a Report).
Or in the Display (a Form).
...Or, ...if this data will be eventually "Merged into Docx files, then create a template to format it in Word.

JeffCoachman
0
 
LVL 18

Author Comment

by:Cluskitt
Comment Utility
Ok, let's try to break it down:

We work with many different companies. One of the things we do is generate the paperwork when someone is hired. Now, many of these companies are part of a group. Therefore, the contract has to have text that varies from company to company:

FIRST: Company Name 1, some legal text
SECOND: Company Name 2, some legal text
etc...

Some have 3, others 4, 6, etc... This text (from first to however many there are) is stored in an access field. It is then sent to word via merge.

If this was all there was to it, there would be no problem. Right now, the merge is working correctly. But we want the "FIRST:", "SECOND:", etc, parts to be bold. That's why I want to merge rich text/html or some other alternative.
Now, if all companies had the same number all the time, it would be easy. After merging, I would just go to the top, search those and make them bold. I don't like Word VBA, but this would be easy. However, seeing as they keep changing, I can't do that (else I might chance things from other clauses).

Hope that clarified things, at least in part. If further clarifications are required, let me know.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
You might want to investigate doing this with a true Rich Text (rtf) control

http://www.lebans.com/richtext.htm
0
A Knowledge Base That Stays Up-to-Date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 18

Author Comment

by:Cluskitt
Comment Utility
That appears to be a control for enabling RTF properties on access. From what I've seen, I don't think it will allow me to pass those RTF properties into a word merge field.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
OK,

Then I am out of ideas...

You might want to do a search ere for keywords:
Access 2007 Insert RTF HTML Rich Text formatting

And see if another post addresses this issue.

Sorry I could not help more.

JeffCoachman
0
 
LVL 18

Author Comment

by:Cluskitt
Comment Utility
Well, from my somewhat extensive net search, it's not an easy issue, though it's also not a common one. I might have to change my code to fix this, instead of relying solely on merge. If it were possible to send RTF to word, though, or have word understand the html that access sends it, that would make my life much easier.
0
 
LVL 18

Accepted Solution

by:
Cluskitt earned 0 total points
Comment Utility
It seems that there are no more ideas. If I have no further suggestions till the end of the week, I'm going to close this question. I will have to use VBA to search for keywords and embolden them one by one.
0
 
LVL 18

Author Closing Comment

by:Cluskitt
Comment Utility
Well, seeing as there are no more ideas, I will have to move on to VBA instead. Thanks for your suggestions.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
My experience with Windows 10 over a one year period and suggestions for smooth operation
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now