Solved

Merging Rich Text/HTML

Posted on 2011-03-18
10
543 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
ID: 35165080
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
ID: 35165433
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
ID: 35167439
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 18

Author Comment

by:Cluskitt
ID: 35167611
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
ID: 35167800
You might want to investigate doing this with a true Rich Text (rtf) control

http://www.lebans.com/richtext.htm
0
 
LVL 18

Author Comment

by:Cluskitt
ID: 35172289
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
ID: 35172737
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
ID: 35175054
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
ID: 35239862
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
ID: 35410334
Well, seeing as there are no more ideas, I will have to move on to VBA instead. Thanks for your suggestions.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

790 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