Default Enter Key Behaviour

4 posts, 1 answers
  1. Anthony
    Anthony avatar
    10 posts
    Member since:
    Feb 2009

    Posted 13 Nov 2012 Link to this post

    I've run into a problem with exporting HTML content from the RadRichTextBox control when exporting a bulleted list. The problem is that each of the list items are surrounded by paragraph tags. So for example if I type something like this:
    The following is a list:

    • Item 1
    • Item 2
    • Item 3

    I get the following HTML:

    <p>The following is a list:</p>
    <ul style="list-style-type:disc">
    <li value="1"><p>Item 1</p></li>
    <li value="2"><p>Item 2</p></li>
    <li value="3"><p>Item 3</p></li>
    </ul>

    The problem is the <p> tags around the list items which are causing extra space to appear between the list items on the report.

    Is there any way to have the editor create list items without putting paragraph tags around them?

  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 14 Nov 2012 Link to this post

    Hello Anthony,

    Unfortunately  there is no setting that can export the lists without <p> tags.

    If we have more information about you scenario, we may be able to give you better advice how to implement the desired functionality. Also it will be useful if you can tell us what export settings you are using for your HTML export and why you need html with stripped paragraph tags.

    Regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Anthony
    Anthony avatar
    10 posts
    Member since:
    Feb 2009

    Posted 14 Nov 2012 Link to this post

    Thanks Mihail,

    The scenario is this: I'm using multiple RadRichTextBox controls each concentrating on a different subject for a school report card. So for example the English teacher has two rich text controls one for the student's strengths and another for the student's next steps. The printed report card has very limited space so additional space between bullets is a serious problem. Space after paragraphs is necessary however.

    We had origianlly created the report card entry system using ASP.NET AJAX rich text controls however we are now porting it over to Silverlight. The ASP.NET rich text controls provided the HTML markup of the entered text with no problems however the Silverlight version seems to be adding the paragraph tags to any bulleted list.

    Here are the export settings I am using:
    string buffer;
    HtmlExportSettings exportSettings = new HtmlExportSettings();
    exportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
    exportSettings.StylesExportMode = StylesExportMode.Inline;
    exportSettings.ExportFontStylesAsTags = true;
    exportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
    exportSettings.PropertiesToIgnore["span"].Add("font-family");
    exportSettings.PropertiesToIgnore["span"].Add("font-size");
    exportSettings.PropertiesToIgnore["p"].Add("margin-top");
    exportSettings.PropertiesToIgnore["p"].Add("margin-bottom");
    exportSettings.PropertiesToIgnore["p"].Add("margin-right");
    exportSettings.PropertiesToIgnore["p"].Add("line-height");
    exportSettings.PropertiesToIgnore["p"].Add("text-indent");
    exportSettings.PropertiesToIgnore["ul"].Add("style");
    HtmlFormatProvider formatProvider = new HtmlFormatProvider();
    formatProvider.ExportSettings = exportSettings;
     
    return formatProvider.Export(editor.Document);

    If you have any suggestions it would be greatly appreciated.

    Thanks,
    Anthony

  5. Answer
    Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 19 Nov 2012 Link to this post

    Hello Anthony,

    Thank you for the detailed information.

    As previously mentioned, it is not possible to export the paragraphs in lists without the <p> tags. In order to remove the extra spacing between paragraphs only in some places, you would have to keep the export tags "margin-top" and "margin-bottom". Then, set the spacing-before and spacing-after to zero for all of the paragraphs you wish to appear with less space around them. 

    If you have further questions, do not hesitate to contact us again.

    Kind regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top