HtmlFormatProvider.Export() not exporting RadDocument correctly.

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

    Posted 17 Oct 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))
                    {
                        document.EnsureDocumentMeasuredAndArranged();
                        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 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. UI for WPF is Visual Studio 2017 Ready
  4. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 20 Oct 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.

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

    Posted 20 Oct 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