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

RadEditor Export Html to Docx with Track Changes

5 Answers 131 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Yogesh
Top achievements
Rank 1
Yogesh asked on 27 Jan 2014, 08:18 AM
Hi,

I am exporting Html content within RadEditor to Docx format using the following code in ASP.NET:

        Telerik.WinControls.RichTextBox.Model.DocxFormatProvider provider = new Telerik.WinControls.RichTextBox.Model.DocxFormatProvider();
            Telerik.WinControls.RichTextBox.Model.RadDocument document = new HtmlFormatProvider().Import(FCKeditorESI.GetHtml(EditorStripHtmlOptions.None));
            

            Telerik.WinControls.RichTextBox.Model.RadDocument htmlDoc;
            var htmlContent = FCKeditorESI.GetHtml(EditorStripHtmlOptions.None);
            var importer = new HtmlFormatProvider();
            var exporter = new DocxFormatProvider();

            using (var stream = new MemoryStream())
            {
                var writer = new StreamWriter(stream);
                writer.Write(htmlContent);
                writer.Flush();
                stream.Seek(0, SeekOrigin.Begin);
                htmlDoc = importer.Import(stream);
            }
            
            //htmlDoc.Measure(RadDocument.MAX_DOCUMENT_SIZE);
            //htmlDoc.Arrange(new RectangleF(PointF.Empty, htmlDoc.DesiredSize));
            var bytes = exporter.Export(htmlDoc);

            Response.Clear();
            Response.ContentType = "application/msword";
            Response.AddHeader("Content-Disposition", "attachment;filename= exportusingtelerik.docx");
            Response.BinaryWrite(bytes);
            Response.End();


The content is exported to "docx" format, but with the following issues:
1. The exported Word file only displays the "normal" content which was entered in RadEditor. Content which was entered with "track changes" in not exported at all.

2. When opening the "docx" file in Apache OpenOffice 4, it gives the following error:
General error.
General input/output error.


I have attached the Html content (Content.jpg) and exported document (exportusingtelerik.jpg) herewith for reference.

Is there any setting required which will export all content, including track changes and metadata information?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Yogesh
Top achievements
Rank 1
answered on 27 Jan 2014, 09:24 AM
Hello,

There is a slight change in the above code snippet:
The instantiation of "DocxFormatProvider" is done using this namespace:

Telerik.WinControls.RichTextBox.FileFormats.OpenXml.Docx.DocxFormatProvider provider = new Telerik.WinControls.RichTextBox.FileFormats.OpenXml.Docx.DocxFormatProvider();
0
Yogesh
Top achievements
Rank 1
answered on 28 Jan 2014, 04:15 AM
Hello,

Can you please give an update?
0
Marin Bratanov
Telerik team
answered on 29 Jan 2014, 04:33 PM
Hello Yogesh,

RadEditor works with HTML content and the tags it uses for its track changes feature are its own, meaning they are not a clone of the MS Word (or any other, for that matter) functionality/logic. Each program has its own set of rules and RadEditor's TrackChanges are designed to work with RadEditor and are not interchangeable with Word's.


Regards,
Marin Bratanov
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Sanchit
Top achievements
Rank 1
answered on 14 Dec 2020, 08:37 AM

Hello Marin,
In our scenario, we are working with RadEditor with track changes &  saving the file in Docx format with the changes. After that, we open the saved file in the RadEdtior but all the changes are done before saving becomes NULL.

Please provide us the solution so that we can keep track of the change history.

0
Rumen
Telerik team
answered on 14 Dec 2020, 10:36 AM

Hi Sanchit,

Thank you for your feature request.

I am afraid that RadEditor's Track Changes functionality is not compatible with MS Word track changes. By design, RadEditor adds specific formatting - HTML tags, inline attributes, and CSS classes which are recognized only by the editor and its content area. 

The required integration with MS Word (import and export) is not available and hard to implement since the MS Word syntax is quite different and it cannot import/provide the tags and styles that RadEditor expects so that it can properly visualize the track changes from the MS Word file.

Best Regards,
Rumen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Editor
Asked by
Yogesh
Top achievements
Rank 1
Answers by
Yogesh
Top achievements
Rank 1
Marin Bratanov
Telerik team
Sanchit
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or