转换HTML到TXT格式
编号:QA000946
建立日期: 1999年5月7日 最后修改日期:1999年5月7日
所属类别:
xiaoxin:
vb5,vb6
Win95
如何找到一个转换HTML到TXT格式的控件或程序段?
回答:
你可以在Simtel(http://www.simtel.net/simtel.net/msdos/html-pre.html)找到一些命令行工具,调用这些命令行工具可以完成转换工作。
转换的原理实际很简单,下面这段代码实际上就是清楚掉TextBox中的所有Tag。
Private Sub ClearTags(rch As TextBox)
Dim txt As String
Dim tag_open As Integer
Dim tag_close As Integer
txt = rch.Text
tag_close = 1
Do
' See where the next tag starts.
tag_open = InStr(tag_close, txt, "<")
If tag_open = 0 Then Exit Do
' See where the tag ends.
tag_close = InStr(tag_open, txt, ">")
If tag_open = 0 Then tag_close = Len(txt)
' Color the tag.
rch.SelStart = tag_open - 1
rch.SelLength = tag_close - tag_open + 1
rch.SelText = ""
Loop
End Sub
此问题由李海回答。
| |
|
|
| |
|
|