一种解决方法是将内容中的换行,空格等转换成<BR>,
给你代码:
Function EText(ByVal strText As String)
Dim i As Integer
Dim strTemp As String
For i = 1 To Len(strText)
If Asc(Mid(strText, i, 1)) = 32 Then
strTemp = strTemp + " "
ElseIf Asc(Mid(strText, i, 1)) = 13 Then
strTemp = strTemp + "<br>"
Else
strTemp = strTemp + Mid(strText, i, 1)
End If
Next
EText = strTemp
End Function
Function DText(ByVal strText As String)
Dim strTmp As String
Dim Skip As Integer = 0
Dim i As Integer
For i = 1 To Len(strText)
If Mid(strText, i, 6) = " " Then
Skip = 6
strTmp = strTmp + " "
ElseIf Mid(strText, i, 4) = "<br>" Then
Skip = 4
strTmp = strTmp + Chr(13)
Else
If Skip = 0 Then strTmp = strTmp + Mid(strText, i, 1)
End If
If Skip > 0 Then Skip -= 1
Next
DText = strTmp
End Function