RadEditor Export Html to Docx with Track Changes

4 posts, 0 answers
  1. Yogesh
    Yogesh avatar
    7 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 Link to this post


    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);
                    stream.Seek(0, SeekOrigin.Begin);
                    htmlDoc = importer.Import(stream);
                //htmlDoc.Arrange(new RectangleF(PointF.Empty, htmlDoc.DesiredSize));
                var bytes = exporter.Export(htmlDoc);

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

    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?

  2. Yogesh
    Yogesh avatar
    7 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 in reply to Yogesh Link to this post


    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();
  3. Yogesh
    Yogesh avatar
    7 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 Link to this post


    Can you please give an update?
  4. Marin Bratanov
    Marin Bratanov avatar
    5347 posts

    Posted 29 Jan 2014 Link to this post

    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.

    Marin Bratanov
    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.
Back to Top