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. Image for the cookie policy date

LoadFromString is truncating text.


I have a variable ("output") that contains this content:

"
<pre>using System; public class Program{    public static void Main()    {        for (int i = 1; i <= 10; i++)        {            Console.WriteLine(i);        }    }}</pre>
"

I've named the html viewer control, "browser".

I call this:

browser.LoadFromString(output);

and this is consistently what displays:

code cut off.png

I've tried other code blocks that are much longer and the entire thing displays fine.

What is it about this particular text that's causing it to truncate?


EDIT: the offending character was the < in <=.

If I'm going to be displaying code blocks in the html control, I'm obviously going to need to display < and > symbols.
I thought that by wrapping the code in <pre> tags, it would work.

How can I do this?



2 Replies

BA BagavathiPerumal Apranandham Syncfusion Team April 4, 2023 01:15 PM UTC

Hi Keith A Price,



HTMLUI is a classic control, and it supports only basic elements and has limitations. Hence, we suggest you to use the WebUI control from WinForms framework to achieve your requirement.




Regards,
Bagavathi Perumal A



RG Rachel Gomez April 6, 2023 01:57 PM UTC

In CSS, text truncation is used to truncate text that overflows its container by hiding the extra content and replacing it with ellipses. This technique is useful for creating more compact and visually appealing layouts in situations where the length of the text may vary, such as in navigation menus, table cells, or headings.


The CSS property you use for text truncation is text-overflow. To enable text truncation, you need to set the text-overflow property to "ellipsis" and the white-space property to nowrap to prevent the text from wrapping to the next line. You may also need to set the overflow property to "hidden" to hide any text that overflows the container.


Regards,

Rachel Gomez


Loader.
Live Chat Icon For mobile
Up arrow icon