C
Chris Richardson
This is a question regarding how to render HTML tags in
the WORD DOC (when dynamically loaded from SQL).
I received a response from Doug Robbins - Word MVP. But I
have another question. Please read below. If anyone can
help I'd really appreciate it
Are you saying that for everything, the HTML Tables,
Horizontal Lines, Bullet and Number List, that I would
have to loop through and convert using the approach
mentioned below? Wow!
I was hoping for something simpler. I'm afraid that I
will not catch all of the HTML tags that are possible to
come through. Also, I wonder if the original look/fill
will be regained.
I read in a seperate post about someone using some code
like:
wrdApp.Documents.Open FileName:="C:\Docs\skeletal.doc",
Format:=wdOpenFormatHTML
I'm not sure what the "FormatHTML" does. Can you
elaborate on this please? Otherwise, can you advise on
any other alternative to making WORD render HTML (the way
that the IE Browser does).
Thanks in advance for taking the time to respond.
the WORD DOC (when dynamically loaded from SQL).
I received a response from Doug Robbins - Word MVP. But I
have another question. Please read below. If anyone can
help I'd really appreciate it
Are you saying that for everything, the HTML Tables,
Horizontal Lines, Bullet and Number List, that I would
have to loop through and convert using the approach
mentioned below? Wow!
I was hoping for something simpler. I'm afraid that I
will not catch all of the HTML tags that are possible to
come through. Also, I wonder if the original look/fill
will be regained.
I read in a seperate post about someone using some code
like:
wrdApp.Documents.Open FileName:="C:\Docs\skeletal.doc",
Format:=wdOpenFormatHTML
I'm not sure what the "FormatHTML" does. Can you
elaborate on this please? Otherwise, can you advise on
any other alternative to making WORD render HTML (the way
that the IE Browser does).
Thanks in advance for taking the time to respond.
..-----Original Message-----
Hi Chris,
The following code in a macro would delete the tags and apply bold
formatting to the text between the tags:
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="\<(STRONG\>)(*)\</ \1",
MatchWildcards:=True, ReplaceWith:="\2", Wrap:=wdFindContinue,
Forward:=True) = True
Selection.Range.Font.Bold = True
Loop
End With
See the article "Finding and replacing characters using wildcards" at:
http://www.mvps.org/word/FAQs/General/UsingWildcards.htm
for and explanation of what the FindText string means.
You will need a similar routine to apply whatever other formatting is
required by other tags.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a consulting basis.
Hope this helps
Doug Robbins - Word MVP
"Chris Richardson"
.