We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to add multiple spaces within the RTE content?

Problem

RTE value set from code behind with multiple spaces are not visibly shown in browser.

Reason

Within the HTML, we cannot change the output by adding extra spaces in HTML code. Since the browser will remove extra spaces when the page is displayed and any number of spaces will count as only one space. Refer this link for in detailed description.

 

Solution

 

On setting RTE value from code behind, which has multiple spaces can be handled in two ways.

  1. Set the string value with multiple spaces in code behind and replace the white-spaces with   in client side create event. Refer the following code block,

 

 

 

 

  1. Set the string value with multiple spaces in code behind and using CSS style white-space to preserve the spaces. In the client side create event, get the iframe document body in RTE and set the CSS white-space with any of the following values based on your requirement to sustain spacing in between RTE content

 

Value

Description

pre

Whitespace is preserved by the browser. Text will only wrap on line breaks.

pre-line

Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks

pre-wrap

Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks

 

 

 

 

 

Figure 1: RTE Value set with multiple spaces

Article ID: Published Date: Last Revised Date: Platform: Control: Product Version:
6512 03/10/2016 03/10/2016 ASP.NET MVC RichTextEditor 13.4.0.53
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.