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

Use html to embed in web

1 Answer 132 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Cesar
Top achievements
Rank 1
Cesar asked on 09 Dec 2016, 08:23 AM

I am trying to use the html code generated by the RichTextEditor to embed it in a webpage and I have a problem with the style that the RichtTextEditor generates.

For example an simple "Hello World" creates the html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
<html xmlns=>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled</title>
<style type="text/css">
p { margin-top: 0px;margin-bottom: 0px;line-height: 1.15; }
body { font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px; }
.Normal { telerik-style-type: paragraph;telerik-style-name: Normal;border-collapse: collapse; }
.TableNormal { telerik-style-type: table;telerik-style-name: TableNormal;border-collapse: collapse; }
</style>
</head>
<body>
<p class="Normal ">Hello World</p>
</body>
</html>

 

This html code can not be embedded on any web since it is generating styles for <body> and <p> tags. This causes the style sheet itself to change from the original page.I need a simpler code, I would need you to not create any style for the general tags of a web. And just create styles for your own classes as you already do by putting some of the text in bold:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ><html xmlns=>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled</title>
<style type="text/css">
p { margin-top: 0px;margin-bottom: 0px;line-height: 1.15; }
body { font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px; }
.Normal { telerik-style-type: paragraph;telerik-style-name: Normal;border-collapse: collapse; }
.TableNormal { telerik-style-type: table;telerik-style-name: TableNormal;border-collapse: collapse; }
.s_6C8EFA9D { telerik-style-type: local;font-weight: bold; }
 </style>
</head>
<body>
<p class="Normal ">Hello <span class="s_6C8EFA9D">World</span></p>
</body>
</html>

 

Is there any way to do it?

Regards.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Dec 2016, 09:06 AM
Hello Cesar,

Thank you for writing.  
 
RadRichTextEditor allows you to export its content by using one of the supported providers. Additional information is available here: http://docs.telerik.com/devtools/winforms/richtexteditor/import/export

However, the HtmlFormatProvider exports the HTML content including the style as well. You can customize how the style is exported, e.g. to be Inline or in Classes by the HtmlExportSettings.StylesExportMode property. In addition, you can use the PropertiesToIgnore method in order to specify which properties to be excluded from the exported data. The following help article is quite useful on this topic: http://docs.telerik.com/devtools/winforms/richtexteditor/import/settings

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Tags
RichTextEditor
Asked by
Cesar
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or