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

Export Normal style without span

1 Answer 8 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Emin
Top achievements
Rank 1
Emin asked on 17 Jul 2018, 11:35 AM

Hello, 

I`m using RTB control to export to html. I want to export Headings with font-size, but Normal style without it. Currently I get in export Normal style as:

<p><span style="font-size: 16px;">test</span></p>

 

I want to export Normal style without span

<p>test</p>

 

I tried like this - but unsuccesfully:

Editor.Document.StyleRepository.GetValueOrNull(RadDocumentDefaultStyles.NormalStyleName).SpanProperties.ClearProperties();

 

I use code to export. but can`t ignore font-size (because it is needed for other Headings)

HtmlExportSettings set = new HtmlExportSettings
                {
                    DocumentExportLevel = DocumentExportLevel.Fragment,
                    ExportBoldAsStrong = true,
                    ExportEmptyDocumentAsEmptyString = true,
                    ExportFontStylesAsTags = true,
                    ExportHeadingsAsTags = true,
                    ExportItalicAsEm = true,
                    ExportStyleMetadata = false,
                    SpanExportMode = SpanExportMode.DefaultBehavior,
                    StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles,
                    StylesExportMode = StylesExportMode.Inline
                };

                set.PropertiesToIgnore["span"].AddRange(new[] { "font-family", "dir" });

 

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 20 Jul 2018, 08:14 AM
Hello Emin,

When exporting to HTML, the model of RadDocument must be mapped to the available HTML elements. Each text content is exported in a span element and I am afraid that this behavior cannot be modified as it resides in the internal logic for mapping the different models. I am sorry I couldn't help more.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Emin
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or