请教一个用ASP显示部分文字问题

来源:百度知道 编辑:UC知道 时间:2024/09/22 19:31:12
我需要在网页上显示20字文章的内容,可是文章内容中有很多字体样式的设置如何只要纯文字,请大侠们帮下

<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 14.25pt"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT size=4>刑事责任</FONT></SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt"><BR></SPAN><FONT size=4><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">已满</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt">16</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">周岁的人犯罪均应负刑事责任;</SPAN>

就是这些该死的文字样式代码,搞的我读不出数据来,可否屏蔽掉?或者在读取的时候有没有什么特殊的设置?
。。。其实只要一句话
style="WORD-WRAP: br

给你一个函数:
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp

objRegExp.IgnoreCase = True
objRegExp.Global = True
'取闭合的<>
objRegExp.Pattern = "<.+?>"
'进行匹配
Set Matches = objRegExp.Execute(strHTML)

' 遍历匹配集合,并替换掉匹配的项目
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
strHtml=replace(strHtml," ","")
strHtml=replace(strHtml,"&","")
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function

你把样式代码去掉不就行了?是这个意思吗?