Completed
Last Updated: 17 Nov 2014 13:20 by Kishore
ADMIN
Ivan Petrov
Created on: 03 Jan 2013 03:13
Category:
Type: Bug Report
3
FIX. RadRichTextBox - HTML - List items of an <ul> or an <ol> list have wrong line spacing when displayed on two or more lines.
To reproduce the issue import the following html text into a rich text box:
<ul>
  <li>Long list item that shoudl be displayed on several lines and should demonstrate the line spacing issue.</li>
</ul>

Resolution: 
This issue is addressed in the new version of the control - RadRichTextEditor. Please use the new control instead the RadRichTextBox. 
6 comments
Kishore
Posted on: 23 Sep 2014 12:32
Sure you are welcome Patrick.

Yeah I hope telerik fix most of the issues in their next release.
Patrick
Posted on: 23 Sep 2014 00:36
By the way Kishore thanks for providing this solution. I originally used rtf formatting in the database but it also has issues that I preferred to avoid until they're fixed. One day all these issues will be fixed and the richtextbox will be a true performer.
Again, thanks!
Kishore
Posted on: 22 Sep 2014 22:10
I am doing the same in my application as follows. 

HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
RadDocument outputContent = htmlProvider.Import(passedResponseHtml);
this.radRichTextBox.Document = outputContent;
this.radRichTextBox.Document.Selection.SelectAll();
 this.radRichTextBox.DocumentView.ChangeParagraphLineSpacing(1.15f, LineSpacingType.AtLeast);
this.radRichTextBox.Document.Selection.Clear();

I don't have a document changed event in my program. But what you are saying makes sense. 
Patrick
Posted on: 22 Sep 2014 21:36
The correct insertion point for this code should be clarified. Since the issue is noticed on saving and then recalling the correct insertion point for my example was here during the loading of the document (from the database in my case). Since I check for file format type (rtf, html, docx, pdf, etc.) I only apply the correction to the html documents. In my example the database retrieves an html document from a SQL Table "Investors" and column "Comments" this occurs from a LINQ foreach loop thus c.Investors.Comments contains the document.

                    else if (c.InvestorComments.Contains("<!DOCTYPE htm"))
                    {
                        HtmlFormatProvider htmProvider = new HtmlFormatProvider();
                        RadDocument document = htmProvider.Import(c.InvestorComments);
                        this.AttachDocument(document);
                        this.radRichTextBox1.Document = document;
                        radRichTextBox1.Document.DocumentContentChanged += new EventHandler(Document_DocumentContentChanged);
                        this.radRichTextBox1.Document.Selection.SelectAll();
                        this.radRichTextBox1.DocumentView.ChangeParagraphLineSpacing(1.15f, LineSpacingType.AtLeast);
                        this.radRichTextBox1.Document.Selection.Clear();
                    }

It is important that the line formatting code occur AFTER the DocumentChangedEvent creation statement that precedes it. If it is placed before you'll cause an infinite loop (StackOverFlow).
This workaround unfortunately triggers a doc change event which can set a boolean "documentChanged" to true even though no changes have occurred so if you have code that checks for unsaved data you will annoy the user with useless reminders to save. So to prevent that reset this documentChanged to false immediately after the selection.Clear() method.
Kishore
Posted on: 22 Sep 2014 16:07
Hi Patrick, the issue you are seeing is due to the spacing issue, for this you need to set the spacing.   But for this you have to select the whole document to do so Like below and apply spacing.

   this.radRichTextBox.Document.Selection.SelectAll();
this.radRichTextBox.DocumentView.ChangeParagraphLineSpacing(1.15f, LineSpacingType.AtLeast);
this.radRichTextBox.Document.Selection.Clear();
Patrick
Posted on: 01 Sep 2014 18:52
If you apply the numering/bullet format to individual text items (one at a time) you will not see the line spacing misbehave initially. But when you save the text list using the html provider (to a database for example) and then recall the document (using the html provider) the line issue will reappear. See the before and after snippets taken using a variation of the Telerik RichText Editor application.

The document was strored in a SQL database using column type "ntext"