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

Export HTML to string

3 Answers 165 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 25 Oct 2019, 09:54 AM

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

3 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 25 Oct 2019, 03:04 PM

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.
0
Frank
Top achievements
Rank 1
answered on 28 Oct 2019, 04:55 AM

Of course I forgot to add the correct assembly.

Thank you for your help.

Regards,

Frank

0
Tanya
Telerik team
answered on 29 Oct 2019, 04:30 PM

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.
Tags
RichTextBox
Asked by
Frank
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Frank
Top achievements
Rank 1
Share this question
or