Use html to embed in web

2 posts, 0 answers
  1. Cesar
    Cesar avatar
    22 posts
    Member since:
    Oct 2012

    Posted 09 Dec 2016 Link to this post

    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.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3478 posts

    Posted 12 Dec 2016 Link to this post

    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.
Back to Top