PDA

View Full Version : Word and Excel htm removes code for jump to highlighting



algrinch
11-23-2010, 02:07 PM
I maintain a number of .htm pages that are created in either word or excel and saved as .htm

These .htm pages are regularly updated using word or excel.

I add the jump to highlighting code by editing the .htm file in notepad and the feature works perfectly.

The problem occurrs when I take that same file, edit it with word or excel and then save it again as .htm. The process removes this line:
<style .highlight { background: #FFFF40;}</style>

Word and/or excel removes this line and adds its own version of the style in the style section of the documment. Often as an entry of p.highlight which does not function with the search response.

Is anyone aware of a solution to this problem?

Thanks
Al

wrensoft
11-23-2010, 05:57 PM
Word and Excel tend to produce fairly awful and slow HTML output.

Maybe there is a better tool you can find for editing HTML. Like Dreamweaver or Web Expression.

Ray
11-23-2010, 11:38 PM
Word and Excel are NOT designed for HTML output. For years it would produced HTML output that did NOT even display in Internet Explorer (yes, Microsoft's own browser).

Having pointed out the obvious, it's worth double checking. The style line you quoted above contains a typo, where the style tag is missing the ">" character.


<style .highlight { background: #FFFF40;}</style>

If this is what you really have on your page, then it might just be filtering it out because its broken HTML.

It should be:


<style type="text/css">.highlight { background: #FFFF40; }</style>

algrinch
11-29-2010, 12:25 PM
I don't think there is a soloution for this. Even though the code quoted in my post was not correct the line of code entered in the document was.

Word converts the style line into this:

p.highlight, li.highlight, div.highlight
{mso-style-name:highlight;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
background:#FFFF40;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}

It doesn't seem to work. The company I work for just agreed to buy Dreamweaver. Hopefully we can quit using word to maintain these files.

Thanks
Al

wrensoft
11-29-2010, 06:28 PM
Yes, Dreamweaver won't destroy HTML code that you add, and thus fix it.