This project is read-only.

Select text programmatically

Oct 16, 2014 at 4:05 PM

I've recently discovered HtmlRender and have a quick question.

Specifically I'm using HtmlPanel in a WinForms application. For my use case, I want to have a button on the form that automatically copies the text displayed in the HtmlPanel to the clipboard.

Is there a way I can achieve that?

I've looked at the control and can see there is a ClearSelection method, but I couldn't find any equivalent method for setting the selection. Nor could I find a method for copying to the clipboard.

Am I missing something?

If not is it possible to add that kind of functionality? Either a SetSelection or SelectAll method, as well as a CopySelection method. Or maybe even a simple CopyToClipboard method to automatically copy all of the text.

Oct 18, 2014 at 12:44 PM
You can use GetHtml() to get the html in the control, then set it to clipboard.
See Setting HTML/Text to Clipboard revisited