problem in writing rtf text in wordpad

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

    problem in writing rtf text in wordpad

    hello everyone..

    In my c# project I want to paste rtf text to wordpad from clipboard.I am using streamwriter for that.

    I have three richtextbox.Fro m that I am able to paste only one rtf text to wordpad....

    here is my code please help me...

    Code:
    StreamWriter sw = new StreamWriter("wpreview.wri");
    
                        for (int i = 0; i < count; i++)
                        {
                            child = clpbrd_panel.Controls["chkbox" + i];
                            if (child != null)
                            {
                                if (((CheckBox)child).Checked == true)
                                {
                                    child = clpbrd_panel.Controls["rtextbox" + i];
                                    ((RichTextBox)child).SelectAll();
                                    ((RichTextBox)child).Copy();
                                    idata = Clipboard.GetDataObject();
                                    
                                
                                    if (idata.GetDataPresent(DataFormats.Rtf))
                                    {
                                     
                                                                                          sw.Write(idata.GetData(DataFormats.Rtf));
                                          sw.WriteLine("");
                                        
                                    }
                             }
                    }
    sw.close();
Working...