HtmlFormatProvider.Export() not exporting RadDocument correctly.

4 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    3 posts
    Member since:
    Aug 2015

    Posted 17 Oct 2016 Link to this post

    I am implementing "edit HTML" functionality by creating a RadDocument and loading a HTML file. Once I modify the RadDocument and try to export/save with below code snippet; the newly HTML has improper rendering. By improper rendering, I mean, some additional content gets added than what appears in the RadDocument.


    //---------------------------Code snippet of Importing-------------------------------------

    document = fromFormatProvider.Import(readStream); ===========> Load the *HTM provider readStream to RadDocument



    // -----------------------------Code snippet of Exporting-------------------------------------

                   IDocumentFormatProvider fromFormatProvider = new HtmlFormatProvider();
                   using (FileStream writeStream = new FileStream(emailtemplateinfo.Path, FileMode.OpenOrCreate))
                        fromFormatProvider.Export(document, writeStream); ======================> Export the newly modified RadDocument to HTM provider

  2. Gaurav
    Gaurav avatar
    3 posts
    Member since:
    Aug 2015

    Posted 17 Oct 2016 in reply to Gaurav Link to this post

    I was able to temporarily workaround this by not using writeStream, instead, convert the bytearray to string


     byte[] byteArray = fromFormatProvider.Export(document);
                    strHTML = System.Text.Encoding.UTF8.GetString(byteArray);
                    File.WriteAllText(emailtemplateinfo.Path, strHTML);

  3. Tanya
    Tanya avatar
    924 posts

    Posted 20 Oct 2016 Link to this post

    Hi Gaurav,

    We are unaware of such a behavior in the HtmlFormatProvider of RadRichTextBox. Could you please share more information on the scenario? How are you modifying the document? It would be of a great help if you can send us a sample document so we can test the issue on our end and check what might cause it.

    If you don't want to share the data in the public forums, you can open a support ticket. In the ticketing system, you can attach .zip files while in the public forums only images are allowed.

    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  4. Gaurav
    Gaurav avatar
    3 posts
    Member since:
    Aug 2015

    Posted 20 Oct 2016 in reply to Tanya Link to this post

    Thanks Tanya for your response. For now, I am not interested to explore this further. But appreciate your response.
Back to Top