Rich Text Editing in Windows Forms
-
20-09-2019 - |
Question
I am using this text editor for my windows forms application
This works great and is a wonderful control, however I am trying to accomplish one task: I wanted to insert a custom tag to the underlying html for eg if user clicks on a button on form I want to insert a tag <myTag>value</myTag>" at the cursor's position of text editor.
Can anyone guide me how to achieve this?
Solution
Guys, Thanks for responses, following code solves the issue
IHTMLTxtRange range = doc.selection.createRange() as IHTMLTxtRange;
range.pasteHTML(string.Format("<span>myTag</span>",range.text));
range.collapse(false);
range.select();
OTHER TIPS
get column and rows of cursor and put your HTML tag there. example if my cursor is blinking some where on the page try to get its X and Y (Rows and Columns).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow