Paste editor to word document

2 posts, 0 answers
  1. Herman
    Herman avatar
    28 posts
    Member since:
    Jun 2011

    Posted 14 May 2012 Link to this post

    I use this code to display html text from sql database in rad editor now i want to paste the text with the color , bold to word document.
    The words paste normal as text not with any colors or bold text just plain texted

    This is the code what i use.
    Paragraph heading3 = new Paragraph();
                                        Run heading_run3 = new Run();
                                        Text heading_text3 = new Text(name);
                                        ParagraphProperties heading_pPr3 = new ParagraphProperties();
                                        // we set the style
                                        heading_pPr3.ParagraphStyleId = new ParagraphStyleId() { Val = "Heading" + num.ToString() };
                                        heading3.Append(heading_pPr3);
                                        heading_run3.Append(heading_text3);
                                        heading3.Append(heading_run3);

                                        
                                        wordDoc.MainDocumentPart.Document.Body.Append(heading3);
                                        if (CheckBox1.Checked == true)
                                        {
                                                ///Add Proposal Description to Document
                                                string html2 = drvSql["Sales_Description"].ToString();
                                                //string id = drvSql["Treeselectedid"].ToString();
                                                RadEditor2.Content = html2;
                                                string t;

                                                StringWriter sw = new System.IO.StringWriter();

                                                
                                                t = RadEditor2.Text;
                                               
                                                Paragraph heading2 = new Paragraph();
                                                Run heading_run2 = new Run();
                                                Text heading_text2 = new Text(t);
                                                ParagraphProperties heading_pPr2 = new ParagraphProperties();
                                                //// we set the style
                                                heading_pPr2.ParagraphStyleId = new ParagraphStyleId() { Val = "Indent" + num.ToString() };
                                                heading2.Append(heading_pPr2);
                                                heading_run2.Append(heading_text2);
                                                heading2.Append(heading_run2);
                                                wordDoc.MainDocumentPart.Document.Body.Append(heading2);
                           
                                        }

  2. Rumen
    Admin
    Rumen avatar
    14417 posts

    Posted 17 May 2012 Link to this post

    Hello,

    The content area of RadEditor is a standard editable IFRAME/DIV element. The copy process is entirely controlled by the browser and RadEditor cannot modify the copied content, because it is not possible to modify it with JavaScript.

    If you would like you can insert the server code via the Format Code Block tool which is convert it to HTML and you can copy the formatted content and paste it in Word with its formatting.


    Best regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top