Дреманович Павел
Конвертация RTF в HTML
http://vbstreets.ru/VB/Articles/66430.aspx
_ae_ писал(а):Тэг font со своими атрибутами уже лет пять как попал в список нежелательных к применению. Или я что-то пропустил?
Function ConvColor(clr As Long) As String
Dim lngClr As Long, R As Long, G As Long, B As Long
Dim strClr As String, sR As String, sG As String, sB As String
strClr = Hex(CStr(clr))
If Len(strClr) = 1 Then
sR = "0" & strClr
sG = "00"
sB = "00"
ElseIf Len(strClr) = 2 Then
sR = strClr
sG = "00"
sB = "00"
ElseIf Len(strClr) = 3 Then
sR = Right(strClr, 2)
sG = "0" & Left(strClr, 1)
sB = "00"
ElseIf Len(strClr) = 4 Then
sR = Right(strClr, 2)
sG = Left(strClr, 2)
sB = "00"
ElseIf Len(strClr) = 5 Then
sR = Right(strClr, 2)
sG = Mid(strClr, 2, 2)
sB = "0" & Left(strClr, 1)
Else
sR = Right(strClr, 2)
sG = Mid(strClr, 3, 2)
sB = Left(strClr, 2)
End If
ConvColor = Chr(34) & "#" & sR & sG & sB & Chr(34)
End Function
- Код: Выделить всё
Function ConvColor(clr As Long) As String
Dim lngClr As Long, R As Long, G As Long, B As Long
Dim strClr As String, sR As String, sG As String, sB As String
strClr = Hex(CStr(clr))
If Len(strClr) = 1 Then
sR = "0" & strClr
sG = "00"
sB = "00"
ElseIf Len(strClr) = 2 Then
sR = strClr
sG = "00"
sB = "00"
ElseIf Len(strClr) = 3 Then
sR = Right(strClr, 2)
sG = "0" & Left(strClr, 1)
sB = "00"
ElseIf Len(strClr) = 4 Then
sR = Right(strClr, 2)
sG = Left(strClr, 2)
sB = "00"
ElseIf Len(strClr) = 5 Then
sR = Right(strClr, 2)
sG = Mid(strClr, 2, 2)
sB = "0" & Left(strClr, 1)
Else
sR = Right(strClr, 2)
sG = Mid(strClr, 3, 2)
sB = Left(strClr, 2)
End If
ConvColor = Chr(34) & "#" & sR & sG & sB & Chr(34)
End Function
Public Function L2H(ByVal color As Long) As String
L2H = Hex(color Or &H10000000)
L2H = """#" + Mid$(L2H, 7, 2) + Mid$(L2H, 5, 2) + Mid$(L2H, 3, 2) + """"
End Function
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0