Export HTML to string

4 posts, 0 answers
  1. Frank
    Frank avatar
    28 posts
    Member since:
    May 2006

    Posted 25 Oct 2019 Link to this post

    Hi,

    I would like to Export my Document to string. In my older Version 2019.1.116 the following code works fine:

    In this case I can use Telerik.Windows.Documents.FormatProviders.Html.HTMLFormatProvider

    HtmlFormatProvider provider = new HtmlFormatProvider() { ExportSettings = new HtmlExportSettings() };

    string comment = provider.Export(radRichTextBox.Document);

    After Update 2019.3.1023 it doesn't work anymore and I have to use Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider

     

    Same with the exportsettings:

    provider.ExportSettings.ExportFontStylesAsTags = true;
    provider.ExportSettings.ExportHeadingsAsTags = true;
    provider.ExportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
    provider.ExportSettings.ExportLocalOrStyleValueSource = true;
    provider.ExportSettings.PropertiesToIgnore["span"].Add("font-family");
    provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-top");
    provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-bottom");

    only the following settings work:

    provider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
    provider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;

     

    What do I have to do to use the old methods again or achieve the same behaviour?

    Regards,

    Frank

  2. Tanya
    Admin
    Tanya avatar
    858 posts

    Posted 25 Oct 2019 Link to this post

    Hi Frank,

    The Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider class is part of RadWordsProcessing and shouldn't be used when working with RadRichTextBox. Could you please verify that the Telerik.Windows.Documents.FormatProviders.Html assembly is added as a reference to the project? Is it with the correct version number?

    The Telerik.Windows.Documents.FormatProviders.Html.HTMLFormatProvider class is available and you should be able to use it in any application which has the required assemblies referenced. 

    Please, let me know how it goes.

    Regards,
    Tanya
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Frank
    Frank avatar
    28 posts
    Member since:
    May 2006

    Posted 27 Oct 2019 in reply to Tanya Link to this post

    Of course I forgot to add the correct assembly.

    Thank you for your help.

    Regards,

    Frank

  4. Tanya
    Admin
    Tanya avatar
    858 posts

    Posted 29 Oct 2019 Link to this post

    Hello Frank,

    I am glad to hear that everything is now working as expected.

    Regards,
    Tanya
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top