How to remove/strip all formatting or styling information from HTML table code?

2k Views Asked by At

How to remove/strip all formatting or styling information from HTML table code?

I need to remove all coloring, font sizing etc. Probably completely remove all style and class attributes.

Probably I would like to just remove some tags and attributes. By removing tag I mean leaving it's content, but removing beginning and ending tag name.

1

There are 1 best solutions below

2
On

I did something like this years ago in VB6. Copied below is the code. As you can see, the code just steps through the HTML character-by-character and removes everything between (and including) the < and > tags. Hopefully you can do something similar in whatever tool you are using.

Function CleanTags(HTML As String) As String
  Dim result As String, b As Boolean, c As String, i As Long
  b = False
  For i = 1 To Len(HTML)
    c = Mid(HTML, i, 1)
    If c = "<" Then b = True
    If b = False Then result = result & c
    If c = ">" Then b = False
  Next i
 CleanTags = result
End Function