Solved

Merging Rich Text/HTML

Posted on 2011-03-18
10
556 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

729 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