Displaying Tabs in SSRS Reports from Telerik RadEditor Content
Environment
Product | Version |
---|---|
RadEditor for ASP.NET AJAX | Any |
Description
When using the Telerik RadEditor to enter content that includes tabs, and saving this content in an MS-SQL database, the tabs are not visible in the generated SSRS reports. The RadEditor saves tabs in HTML format using the <span style="white-space:pre;"> </span>
tag. However, the SSRS report does not render the tabs as expected.
This KB article also answers the following questions:
- How can I ensure that tabs from RadEditor content appear in SSRS reports?
- What method should I use to convert tabs into spaces for SSRS report visibility?
- Is there a way to make white-space preserved in HTML content visible in SSRS reports?
Solution
To resolve the issue of tabs not being displayed in SSRS reports, convert the tabs into a specific number of spaces before saving the content to the database. This conversion ensures that SSRS, which may not fully support the white-space: pre;
CSS property, can correctly display the spaces in place of tabs.
Here is a step-by-step approach to replace tabs with spaces in the RadEditor's content:
-
Identify the HTML content in RadEditor that contains tabs. Usually, tabs are saved as
<span style="white-space: pre;"> </span>
in HTML. -
Choose the number of spaces you wish to use to represent a tab. Commonly, four non-breaking spaces (
) are used. -
Use the following code snippet to replace the tab representation in HTML with your chosen number of spaces:
// Assuming RadEditor1.Content contains the HTML content
// Define the replacement for the tab-span with a sequence of non-breaking spaces
string tabReplacement = " "; // Example: 4 non-breaking spaces
// Replace each occurrence of the tab-span with the tabReplacement string
RadEditor1.Content = RadEditor1.Content.Replace("<span style=\"white-space: pre;\"> </span>", tabReplacement);
-
Save the modified content back to the database.
-
The SSRS report should now display the spaces in place of tabs, ensuring the formatting is preserved as intended.
Notes
- The solution provided here assumes that the RadEditor content is being processed server-side before being saved to the database.
- Adjust the number of non-breaking spaces based on your formatting requirements.