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

Get rid of <style> tag

2 Answers 52 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tracey
Top achievements
Rank 1
Tracey asked on 15 Feb 2012, 05:45 PM
Hi

I am using the I am using the RadRichTextBox as a html editor and using the following to format the html
// html export settings
            HtmlFormatProvider htmlFormatProvider = new HtmlFormatProvider();
            HtmlExportSettings settings = new HtmlExportSettings { ImageExportMode = ImageExportMode.ImageExportingEvent, DocumentExportLevel = DocumentExportLevel.Fragment, StylesExportMode = StylesExportMode.Inline };
            settings.ImageExporting += (s, e) =>
            {
                e.Src = e.Image.UriSource.ToString();
                e.Alt = "image";
            };
            htmlFormatProvider.ExportSettings = settings;
            HtmlExport.FormatProvider = htmlFormatProvider;

I recently upgraded the rad controls and now the editor is adding a <style> tag to the beginning of the html like this:
 
<style type="text/css"
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } 
.defaultDocumentStyle { telerik-style-type: default;telerik-style-name: defaultDocumentStyle;font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 12px;margin-bottom: 12px; } 
</style>

It is very annoying because it is mucking up the p tags in the rest of the webpage (as the html editor is just used for content snippets)

Is there a way of getting rid of this style tag?

Many Thanks
Tracey

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivailo Karamanolev
Telerik team
answered on 17 Feb 2012, 12:26 PM
Hello,

I see that you have set StylesExportMode=StylesExportMode.Inline, but because RadRichTextBox supports styles, they are also exported to HTML. To stop that, since you want to avoid the <style>, you can also set StyleRepositoryExportMode=StyleRepositoryExportMode.DontExportStyles.
Let us know if you need further assistance.

All the best,
Ivailo Karamanolev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Tracey
Top achievements
Rank 1
answered on 17 Feb 2012, 12:32 PM
Great! Thank you very much
Tags
RichTextBox
Asked by
Tracey
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Tracey
Top achievements
Rank 1
Share this question
or