get text from clipboard as html formate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpfreak2007
    New Member
    • Sep 2007
    • 31

    get text from clipboard as html formate

    Hi everyone...

    I want to copy text from clipboard and paste into my project.I am able to do it but problem is Its not in same formate..That means I want bold letter as bold and with same font .....means If I copy it from website then its html formate remain same...
  • balame2004
    New Member
    • Mar 2008
    • 142

    #2
    Originally posted by phpfreak2007
    Hi everyone...

    I want to copy text from clipboard and paste into my project.I am able to do it but problem is Its not in same formate..That means I want bold letter as bold and with same font .....means If I copy it from website then its html formate remain same...

    Can you show your code here?

    Comment

    • phpfreak2007
      New Member
      • Sep 2007
      • 31

      #3
      Originally posted by balame2004
      Can you show your code here?
      Code:
      IDataObject idata = Clipboard.GetDataObject();
      
      
      if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Html))
      {
             rtextbox.Text = rtextbox.Text + (string)idata.GetData(DataFormats.Html);
      }
      else if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
      {
             rtextbox.Text = rtextbox.Text + Clipboard.GetText();
      }
      thanks for reply...This is part of my code,,,where rtextbox is rich textbox

      Comment

      Working...