When you copy from one program's document and paste in another program's document, you almost never want to keep the formatting.A simple example is when you copy from word or other document into the rich text control that .Text uses on the New Post page, you get a hunk of unwanted HTML around the pasted text.What a worry it is!
    Ok, Maybe this program can help you out:)

Rich Code Plain Code  
Code snippet of the day : Convert Rich Text Into Plain Text.
using System; 2using System.Windows.Forms; 3namespace PlainClipper { 4 class Class1 { 5 [STAThread] 6 static void Main(string[] args) { 7 IDataObject oldclip = Clipboard.GetDataObject(); 8 if (oldclip != null) { 9 DataObject newclip = new DataObject(); 10 foreach (string format in oldclip.GetFormats()) { 11 if (format != "HTML Format") { 12 newclip.SetData(format, oldclip.GetData(format)); 13 } 14 } 15 Clipboard.SetDataObject(newclip, true); 16 } 17 } 18 } 19}
using System;
using System.Windows.Forms;
namespace PlainClipper {
  class Class1 {
    [STAThread]
    static void Main(string[] args) {
      IDataObject oldclip = Clipboard.GetDataObject();
      if (oldclip != null) {
        DataObject newclip = new DataObject();
        foreach (string format in oldclip.GetFormats()) {
          if (format != "HTML Format") {
            newclip.SetData(format, oldclip.GetData(format));
          }
        }
        Clipboard.SetDataObject(newclip, true);
      }
    }
  }
}

See Orginal Article: The smallest useful program I've ever written

相关文章: