Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2002
    Location
    London, Gtr London, England
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding HTML to Word 2000/2002 (2000/2002)

    I wonder if anyone know how to do the following. I'm trying to tag text in the document so that the text is displayed but the tags is only held in the HTML part of the document. i.e. if a tag the word TEXT then text is displayed in the document but <Tag txt=TEXT> (or similar) is displayed when viewing the HTML. I want to do this so that my users can tag Net prices on a document but I can then use PERL to parse the HTML to display different currencies of Gross prices when it is displayed in a browser.

    I can put the TEXT in a Macrobutton Field {MACROBUTTON NoMacro TEXT]} and parse from that but the HTML output from a field is untidy and I just wondered if there was a better way of doing it?

    Thanks for any help you can offer
    Richard

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Adding HTML to Word 2000/2002 (2000/2002)

    Let me try to summarize what I think you are describing:
    1. <LI>Start by creating a Word document with the "visible" information as ordinary text.
      <LI>Connect hidden text to words in the document that will survive Word's Save As HTML filter.
      <LI>Save the document as HTML.
      <LI>Use a perl script to clean up the resulting HTML.
    Is this right? If you don't need the Word document to be pretty on its own, or you can maintain two versions, the best approach might be to insert HTML markup as text into the document. So, you would replace

    Widget

    with

    <TAG txt="Widget">

    You can write a macro in Word that, when the word Widget is selected, will envelop it in the tag syntax so this is a one button operation. For example, these are the operative lines from my "bold tags" macro:

    Selection.Range.InsertBefore ""
    Selection.Range.InsertAfter "
    "

    Now, your angle brackets will be converted to the & lt; and & gt; syntax when Word does its Save As HTML. Your perl script will have to flip these back into angle brackets in the appropriate cases. But in my opinion this would be the easiest way to work with the <img src=/w3timages/censored.gif alt=censored border=0> output as HTML by Word.

    If you are not using Word to generate your HTML for you, there probably are other and better solutions.

  3. #3
    New Lounger
    Join Date
    May 2002
    Location
    London, Gtr London, England
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding HTML to Word 2000/2002 (2000/2002)

    Thanks for the advise. I'll try it out

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •