Formatting issue with HTMLTextbox

3 Answers 36 Views
Report Designer - Web Report Viewer - HTML5
Mr.Pramod
Top achievements
Rank 1
Mr.Pramod asked on 18 Jan 2025, 08:30 AM | edited on 20 Jan 2025, 04:48 AM

I am getting html content from database and i am showing that in telerik report details section in table .In table body i have added htmltextbox . There is lot's of space between row and also need to align whole content in align left .but i am unable to get .I try replace function still not working.

Could u please help me to achieve this. I notice while loading the report  Telerik applying some of the classes 

If we add single   it giving to much space due to Telerik rendering couple of tag by default

3 Answers, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 20 Jan 2025, 03:39 PM

Hello Pramod,

Thank you for your interest in Telerik Reporting.

Could you please confirm if you are referring to a situation where you have an HTML like this?:

&nbsp;<p>This is a sample paragraph with some <strong>bold text</strong> and <em>italic text</em>.</p>&nbsp;

If this is the case, it may explain the extra spaces between the rows. Generally, the HTML content rendered through the HtmlTextBox component should have a single root element. In the example provided, the first non-breaking space, the paragraph, and the last non-breaking space are treated as three separate elements during the parsing of the HTML by Telerik Reporting. Therefore, it renders <div> elements for each of them, and these <div>s are holding place each:

If your case is the same as the example above, using an expression like this would typically resolve it.

{Replace(Fields.HTMLContent, "&nbsp;", " ")}

Additionally, please be aware that there are limitations to what the HtmlTextBox supports. For instance, CSS can only be added using inline styles, and some properties, like margin are not currently supported. To see the complete list of supported features, please refer to the relevant article in our documentation:

If you need further assistance, could you please provide more details about the issue? Specifically, let us know if the extra space occurs with any HTML content, such as a simple paragraph like <p>a paragraph</p>, or if it's related to something specific. If it is the second, a reproducible HTML example would be greatly appreciated

Regards,
Petar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Mr.Pramod
Top achievements
Rank 1
commented on 21 Jan 2025, 07:11 AM

Hi Peter Thanks for reply

Below is the Html i have.

<p><b>Pramod Gupta:</b> Check www.511MN.org before moving. Road conditions, restrictions and closures can change unexpectedly on permitted routes.</p><p> </p>
<p><b>Text Assume YOU HAUL</b><br><br>Watercrafts destined for Washington, Oregon, Idaho, or Montana must contact The Pacific States Marine Fisheries Commission (PSMFC) to have your watercraft inspected and if need be, decontaminated. This program aims to prevent the spread of aquatic invasive species. Call 1-844-311-4873 prior to hauling. For more information visit https://www.westernais.org/watercraft</p><p> </p>
<p><b>Live CONDITIONS</b></p><p><span style="letter-spacing: -0.15pt"><font><font color="rgba(0, 0, 0, 1)">This Annual permit allows for the transport of Oversize; Overweight commercial boats; transporting waterfront structures including, but not limited to portable boat docks and boat lifts.</font></font></span></p>
<p>The following Annual Permit Attachments must be available upon request:</p><ul><li>Limits for Oversize/Overweight <span style="line-height: 12.84px">(OS/OW) Annual Permit Attachment</span></li></ul><ul><li>Minnesota General Provisions</li></ul>
<p><b>Some Hello</b></p><ul><li>Route Approvals (Trip Logs) are required when exceeding legal weight, or exceeding 11 feet wide, or exceeding 14 feet 6 inches high and must be logged on the Minnesota SUPERLOAD Permit System.</li></ul>

 

i try with Replacing as u provided but still not working.

below is the screenshot which i am getting output.

 

Mr.Pramod
Top achievements
Rank 1
commented on 21 Jan 2025, 07:11 AM

I have HTML like this in Database

<p><b>Pramod Gupta:</b> Check www.511MN.org before moving. Road conditions, restrictions and closures can change unexpectedly on permitted routes.</p><p> </p>
<p><b>Text Assume YOU HAUL</b><br><br>Watercrafts destined for Washington, Oregon, Idaho, or Montana must contact The Pacific States Marine Fisheries Commission (PSMFC) to have your watercraft inspected and if need be, decontaminated. This program aims to prevent the spread of aquatic invasive species. Call 1-844-311-4873 prior to hauling. For more information visit https://www.westernais.org/watercraft</p><p> </p>
<p><b>Live CONDITIONS</b></p><p><span style="letter-spacing: -0.15pt"><font><font color="rgba(0, 0, 0, 1)">This Annual permit allows for the transport of Oversize; Overweight commercial boats; transporting waterfront structures including, but not limited to portable boat docks and boat lifts.</font></font></span></p>
<p>The following Annual Permit Attachments must be available upon request:</p><ul><li>Limits for Oversize/Overweight <span style="line-height: 12.84px">(OS/OW) Annual Permit Attachment</span></li></ul><ul><li>Minnesota General Provisions</li></ul>
<p><b>Some Hello</b></p><ul><li>Route Approvals (Trip Logs) are required when exceeding legal weight, or exceeding 11 feet wide, or exceeding 14 feet 6 inches high and must be logged on the Minnesota SUPERLOAD Permit System.</li></ul>

I try Replacing the  but still not working . below is the screenshot for output

 

0
Krasimir
Top achievements
Rank 3
Iron
Iron
answered on 21 Jan 2025, 07:29 AM

Hello Pramod,

I've attached a sample report demonstrating some of the features related to HTML rendering. I hope that this would provide some additional details on top of Petar's post.

Keep in mind the Styling and Formatting link above that explains how HTML boxes are rendered. You could play around with the data source records to identify what is causing the white spaces on your side.

Regards,
Krasi

0
Petar
Telerik team
answered on 23 Jan 2025, 04:33 PM

Hello Pramod,

Thank you for providing the details.

For the space, I suspect the <br> tags could be the reason for this behavior. Could you try to replace them using an expression like this:

{Replace(Fields.HTMLContent, "<br>", "")}

That being said, I tried to render the HTML you sent into a single HtmlTextBox but ran into issues. I had to format it manually a bit, and got the following result:

The result is pretty similar, except for the space between the first three paragraphs. Could you confirm if this is the result you are trying to achieve on your end? Also, are you rendering the whole HTML you sent in a single HtmlTextBox or multiple?

As for the alignment issue, could you please send screenshots of current and expected result? This would help me better understand your requirements.

Regards,
Petar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
Report Designer - Web Report Viewer - HTML5
Asked by
Mr.Pramod
Top achievements
Rank 1
Answers by
Petar
Telerik team
Krasimir
Top achievements
Rank 3
Iron
Iron
Share this question
or