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

Default Enter Key Behaviour

3 Answers 72 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.
Anthony
Top achievements
Rank 2
Anthony asked on 13 Nov 2012, 03:24 PM

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?

3 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 14 Nov 2012, 02:10 PM
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.

0
Anthony
Top achievements
Rank 2
answered on 14 Nov 2012, 05:30 PM
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

0
Accepted
Mihail
Telerik team
answered on 19 Nov 2012, 10:59 AM
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.

Tags
RichTextBox
Asked by
Anthony
Top achievements
Rank 2
Answers by
Mihail
Telerik team
Anthony
Top achievements
Rank 2
Share this question
or