Dealing with overriding styles with stylesheets in Microsoft Word

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael J. Hudson

    Dealing with overriding styles with stylesheets in Microsoft Word

    I'm not sure what good attaching a stylesheet to a Microsoft Word
    document does. When you save the document as an HTML file, Word
    throws in all of its style and font settings into the HTML file AND
    these settings override the same properties you may have specified in
    your stylesheet. So, what good is it to attach a stylesheet????

    I've only found one way to overcome this problem. You can append each
    of the characteristics in your stylesheet with the keyword
    "!important " and that will override whatever styles Word put into the
    HTML document. For instance:

    P { font-size: 18pt ! important }

    You can also write a script to parse out the style settings from the
    beginning of the document, but that just seems like more than you
    should have to do to get this to work!

    Anyway, just wanted to pass on the "!important " keyword solution...
    since it took me a while to figure it out for myself.

    -Michael
  • Mark Tranchant

    #2
    Re: Dealing with overriding styles with stylesheets in MicrosoftWord

    Michael J. Hudson wrote:[color=blue]
    > When you save the document as an HTML file, Word[/color]

    Don't do it, then. Word doesn't generate HTML. What comes out may look
    similar, and IE might have a reasonable go at rendering it, but Word is
    far worse even than Frontpage at creating HTML.

    --
    Mark.

    Comment

    • Lachlan Hunt

      #3
      Re: Dealing with overriding styles with stylesheets in MicrosoftWord

      Michael J. Hudson wrote:[color=blue]
      > I'm not sure what good attaching a stylesheet to a Microsoft Word
      > document does.[/color]

      I'm not sure what good creating HTML document in Word does. When you
      save the document in
      [color=blue]
      > When you save the document as an HTML file, Word...[/color]

      only ever writes invalid code. It can be helped if you choose Filtered
      HTML, and then ignore the stupid warning message about losing MSWord
      specific formatting (obviously intended to stop an average user from
      producing code that is even close to valid).

      It takes a little effort to clean up afterwards, but IIRC, there's only
      about a dozen or so errors with Word's Filtered HTML, compared with
      several hundred from the non-filtered crap with. It's the only editor
      worse than FrontPage, but FrontPage isn't much better.
      [color=blue]
      > I've only found one way to overcome this problem...[/color]

      is to not use Word for creating HTML documents.
      [color=blue]
      > Anyway, just wanted to pass on the "!important " keyword solution...[/color]

      Thanks, but I prefer to use the advice I gave above.

      --
      Lachlan Hunt

      http://GetFirefox.com/ Rediscover the Web
      http://SpreadFirefox.com/ Igniting the Web

      Comment

      • Brian

        #4
        Re: Dealing with overriding styles with stylesheets in MicrosoftWord

        Mark Tranchant wrote:
        [color=blue]
        > Word doesn't generate HTML. What comes out may look
        > similar, and IE might have a reasonable go at rendering it,[/color]

        Don't be too sure. A friend once loaded his cv in Word, and saved as
        HTML. The result could be viewed in Mozilla, but MSIE/Win choked on it,
        displaying raw code in several sections. That one gave me a good chuckle.

        --
        Brian (remove "invalid" to email me)

        Comment

        Working...