简体   繁体   中英

How to read copied html text from clipboard with its html tags?

When a user selects and copies a text from a web page, I need to get that text with all the html tags included so that I can select some specific attributes etc.

Is it possible to read it from .NET application?

thanks

The Clipboard.GetText method will retrieve HTML content from the clipboard:

var htmlData = System.Windows.Clipboard.GetText(System.Windows.TextDataFormat.Html);

You can check if the clipboard contains HTML with the Clipboard.ContainsText method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM