-
Sep 12th, 2022, 08:38 AM
#1
Thread Starter
Banned
[RESOLVED] richtextbox selected text add html code start and end
this is a demo text i love you peace
this is a demo text i love you peace
Code:
this is a demo text <font style="color:red">i love you</font> peace
-
Sep 12th, 2022, 09:10 AM
#2
Re: richtextbox selected text add html code start and end
And your question is?
The RichTextBox can not show the markup of HTML text.
So you have to use some other component or convert the HMTL to RTF (RichText Format)
-
Sep 12th, 2022, 09:45 AM
#3
Re: richtextbox selected text add html code start and end
Originally Posted by Arnoutdv
So you have to use some other component or convert the HMTL to RTF (RichText Format)
That's actually an interesting idea, and I don't think I've ever seen any VB6 code to do that.
You could probably automate Word to do it for you though, but a pure VB6 solution would be cool.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Sep 12th, 2022, 10:55 AM
#4
Re: richtextbox selected text add html code start and end
There are multiple solutions when you Google for HTML2RTF.
A premade OCX:
https://vbcoders.com/code/html2rtf-p...ing-27904.html
-
Sep 12th, 2022, 11:05 AM
#5
Re: richtextbox selected text add html code start and end
I guess I'm just too old and feeble, but I can't decipher the pidgin-post above enough to figure out what the OP is trying to ask for.
This might be useful if the intent is to have a RichEdit control accept HTML markup input. The RichTextBox may wrap too old a version of RichEdit control to do this. In that case the easiest alternative is an InkEdit control.
RichEdit HTML Support
-
Sep 12th, 2022, 11:16 AM
#6
Thread Starter
Banned
Re: richtextbox selected text add html code start and end
Originally Posted by Arnoutdv
And your question is?
The RichTextBox can not show the markup of HTML text.
So you have to use some other component or convert the HMTL to RTF (RichText Format)
i want the html tags to be inserted at the begining and end of the selection text
i dont want it converted i need the raw html code inserted only
Last edited by tuffan; Sep 12th, 2022 at 11:19 AM.
-
Sep 12th, 2022, 11:29 AM
#7
Re: richtextbox selected text add html code start and end
The just add them to the .SelText property of the RTB control
-
Sep 12th, 2022, 11:29 AM
#8
Re: richtextbox selected text add html code start and end
Code:
Private Sub InsertRedTag()
Dim iSS As Long
Dim iSL As Long
Const cRedTag As String = "<font style=""color:red"">"
Const cCloseFontTag As String = "</font>"
iSS = RTBControl.SelStart
iSL = RTBControl.SelLength
RTBControl.SelLength = 0
RTBControl.SelText = cRedTag
RTBControl.SelStart = iSS + Len(cRedTag) + iSL
RTBControl.SelText = cCloseFontTag
RTBControl.SelStart = iSS + Len(cRedTag)
RTBControl.SelLength = iSL
End Sub
-
Sep 12th, 2022, 11:47 AM
#9
Thread Starter
Banned
Re: richtextbox selected text add html code start and end
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|