I want to write Html format, but I can not even get a simple MSDN example of it to work.
http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx
Does this console app, a clipboard round tripper, work for anyone?
using System; using System.Windows; //Need to add a PresentationCore or System.Windows.Forms reference class Program { [STAThread] static void Main( string[] args ) { Console.WriteLine( "Copy a small amount of text from a browser, then press enter." ); Console.ReadLine(); var text = Clipboard.GetText(); Console.WriteLine(); Console.WriteLine( "--->The clipboard as Text:" ); Console.WriteLine( text ); Console.WriteLine(); Console.WriteLine( "--->Rewriting clipboard with the same CF_HTML data." ); //***Here is the problem code*** var html = Clipboard.GetText( TextDataFormat.Html ); Clipboard.Clear(); Clipboard.SetText( html, TextDataFormat.Html ); var text2 = Clipboard.GetText(); Console.WriteLine(); Console.WriteLine( "--->The clipboard as Text:" ); Console.WriteLine( text2 ); var isSameText = ( text == text2 ); Console.WriteLine(); Console.WriteLine( isSameText ? "Success" : "Failure" ); Console.WriteLine(); Console.WriteLine( "Press enter to exit." ); Console.ReadLine(); } }