Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Merging text with HTML tags as data source into single word docume

Geek News

Merging text with HTML tags as data source into single word docume
Michael 6/20/2007 11:26:00 AM
Dear all, I have a .doc document and a data source from an oracle database
which stores HTML data as text. The front end application has no problem
recognizing the HTML tags and would display the HTML texts correctly. But
once I tried to merge this HTML text to the Word document, Word would show
the HTML tags as is. i.e. <BR>test</BR> instead of a line break before
'test', a & instead of &, and a <B>bold</B> instead of a bolded 'bold'
text.

I wonder if there's a way to make Word interpret the HTML tags automatically
during the mail merge?

Thanks in advance,
Michael
Re: Merging text with HTML tags as data source into single word docume
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 6/20/2007 7:17:43 PM
[Quoted Text]
> I wonder if there's a way to make Word interpret the HTML tags
> automatically
> during the mail merge?

No, sorry.

If I had to do this, I would probably
a. "roll my own merge" in VBA, using ADO to get the data from Oracle
b. either save the HTML snippets as .htm files which I would then include
either using VBA or via INCLUDETEXT, or
c. write my own interpreter that stuffed the field contents in and applied
the appropriate formats. And I'd only actually consider that if the allowed
HTML tags were a very, very simple subset of what HTML allows.

I can think of variations on that theme, but none which would substantially
reduce the complexity, except maybe if...you could write an Oracle PL/SQL
procedure (sorry, I'm way out of date with Oracle these days - perhaps it's
something else now) that emitted either a set of .htm files for each merge
record, or (conceivably) a single HTML file with bookmarks that identified
each field in each record. You might then be able to INCLUDETEXT the info,
complete with formatting, in your merge. Not my idea of fun.

Peter Jamieson


"Michael" <Michael[ at ]discussions.microsoft.com> wrote in message
news:6DA1E133-78BB-4176-82D8-DE172362C6E5[ at ]microsoft.com...
> Dear all, I have a .doc document and a data source from an oracle database
> which stores HTML data as text. The front end application has no problem
> recognizing the HTML tags and would display the HTML texts correctly. But
> once I tried to merge this HTML text to the Word document, Word would show
> the HTML tags as is. i.e. <BR>test</BR> instead of a line break before
> 'test', a & instead of &, and a <B>bold</B> instead of a bolded 'bold'
> text.
>
> I wonder if there's a way to make Word interpret the HTML tags
> automatically
> during the mail merge?
>
> Thanks in advance,
> Michael


Re: Merging text with HTML tags as data source into single word do
Michael 6/21/2007 9:15:01 AM
Thanks Peter.

"Peter Jamieson" wrote:

[Quoted Text]
> > I wonder if there's a way to make Word interpret the HTML tags
> > automatically
> > during the mail merge?
>
> No, sorry.
>
> If I had to do this, I would probably
> a. "roll my own merge" in VBA, using ADO to get the data from Oracle
> b. either save the HTML snippets as .htm files which I would then include
> either using VBA or via INCLUDETEXT, or
> c. write my own interpreter that stuffed the field contents in and applied
> the appropriate formats. And I'd only actually consider that if the allowed
> HTML tags were a very, very simple subset of what HTML allows.
>
> I can think of variations on that theme, but none which would substantially
> reduce the complexity, except maybe if...you could write an Oracle PL/SQL
> procedure (sorry, I'm way out of date with Oracle these days - perhaps it's
> something else now) that emitted either a set of .htm files for each merge
> record, or (conceivably) a single HTML file with bookmarks that identified
> each field in each record. You might then be able to INCLUDETEXT the info,
> complete with formatting, in your merge. Not my idea of fun.
>
> Peter Jamieson
>
>
> "Michael" <Michael[ at ]discussions.microsoft.com> wrote in message
> news:6DA1E133-78BB-4176-82D8-DE172362C6E5[ at ]microsoft.com...
> > Dear all, I have a .doc document and a data source from an oracle database
> > which stores HTML data as text. The front end application has no problem
> > recognizing the HTML tags and would display the HTML texts correctly. But
> > once I tried to merge this HTML text to the Word document, Word would show
> > the HTML tags as is. i.e. <BR>test</BR> instead of a line break before
> > 'test', a & instead of &, and a <B>bold</B> instead of a bolded 'bold'
> > text.
> >
> > I wonder if there's a way to make Word interpret the HTML tags
> > automatically
> > during the mail merge?
> >
> > Thanks in advance,
> > Michael
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net