Link to home
Start Free TrialLog in
Avatar of tonejunkie
tonejunkie

asked on

FP HTML editor keeps inserting spaces (&_nbsp_;)

Hi,

I have a DB result set from which I pull out a number, like this:  <td><%=rs("Num")%>&nbsp;</td>
I need to get rid of the blank space (&_nbsp_;) in that cell which FrontPage automatically inserts after I save the file.  Even though I have the "Preserve existing HTML" option checked.

Any help?
Thanks in advance.
Avatar of Wrdslngr
Wrdslngr

The only way I've ever been able to eliminate the FrontPage trash code is to finish the site, then do a global replace, replacing &nbsp; with nothing in the lower box.  If you select ALL PAGES and FIND IN HTML, the replace tool will go through the entire site and eliminate the trash (at least until the next time you open that page).  ;-)~~
Before I forget to say so...

Always make sure you have published a copy of the site locally prior to doing a global replace, just in case.  ;-)
tonejunkie,

Create a macro using this code.  This macro searches for the <TD> tag, removes the
&nbsp; (space), and sets the height of the cell at 9.  This should take care of the problem.


Sub TableDeSpacer()
  With ActiveDocument
  For i = 0 To .all.Length - 1
  If UCase(.all(i).tagName) = "TD" Then
  If .all(i).innerHTML = "&nbsp;" Then
  .all(i).Height = 9
  End If
  End If
  Next
  End With
  End Sub
Avatar of tonejunkie

ASKER

I guess I'm looking for more of an option in FrontPage settings which would disable any automatic code changes.  And "Preserve existing HTML" obviously doesn't work.  But the only thing I've come up with was to finish the page, and then open it in Notepad to get rid of the extra crap FrontPage throws in.  Which is almost as annoying as having to code around it.

What a waste of a product this thing is.  :)
ASKER CERTIFIED SOLUTION
Avatar of jdfulton
jdfulton
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well I need some of the spaces to stay in, but I need to get rid of some.  So I guess there is no solution to this question.
Since there is no solution, there is no answer.
tonejunkie,

You can use the macro in the same way to add spaces.
Just guessing, but if you're looking for a way to get an answer that will FIX FrontPage problems with trash code...you should call Microsoft.  All we can do as end users is recommend work-arounds we've had to use ourselves.  It looks like the Macro will work, I know the replace option works to accomplish the same thing in a different way...but we can't fix the original problem with the software.  Sorry.