Click here to get back home

Dealing with overriding styles with stylesheets in Microsoft Word

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Dealing with overriding styles with stylesheets in Microsoft Word Michael J. Hudson 11-19-2004
Get Chitika Premium
Posted by Michael J. Hudson on November 19, 2004, 7:28 am
Please log in for more thread options
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


Posted by Mark Tranchant on November 19, 2004, 3:57 pm
Please log in for more thread options
Michael J. Hudson wrote:
> When you save the document as an HTML file, Word

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.
http://tranchant.plus.com/


Posted by Brian on November 19, 2004, 8:58 pm
Please log in for more thread options
Mark Tranchant wrote:

> Word doesn't generate HTML. What comes out may look
> similar, and IE might have a reasonable go at rendering it,

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)


Posted by Lachlan Hunt on November 19, 2004, 4:22 pm
Please log in for more thread options
Michael J. Hudson wrote:
> I'm not sure what good attaching a stylesheet to a Microsoft Word
> document does.

I'm not sure what good creating HTML document in Word does. When you
save the document in

> When you save the document as an HTML file, Word...

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.

> I've only found one way to overcome this problem...

is to not use Word for creating HTML documents.

> Anyway, just wanted to pass on the "!important" keyword solution...

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

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web


Similar ThreadsPosted
tidy ms word output as pure xhtml without css style and font styles July 10, 2007, 5:10 am
Can AJAX dealing with XSLT instead DOM? November 14, 2006, 8:34 am
Overriding CSS Declaration for Different Use March 30, 2008, 4:50 pm
overriding inner nested November 27, 2006, 12:53 pm
Re: overriding inner nested December 7, 2006, 12:51 pm
alternate stylesheets August 12, 2004, 1:37 pm
Microsoft finally kill Mac/IE December 19, 2005, 6:33 pm
User stylesheets for specific sites December 21, 2005, 8:33 am
Including CSS Stylesheets - or @import? January 17, 2007, 9:25 am
=?iso-8859-1?q?Microsoft=AE_Expression=AE_Web_Designer_preview_release?= May 16, 2006, 9:52 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap