views:

173

answers:

2

I am using following text editor for my windows forms application

http://www.codeproject.com/KB/edit/editor_in_windows_forms.aspx

This works great and a wonderful control, however I am trying to accomplish one task i.e. 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?

A: 

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).

Aizaz
A: 

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();
fawad