This is a migrated thread and some comments may be shown as answers.

Paste editor to word document

1 Answer 49 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Herman
Top achievements
Rank 1
Herman asked on 14 May 2012, 01:33 PM
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);
                       
                                    }

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 May 2012, 12:10 PM
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.
Tags
Editor
Asked by
Herman
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or