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 and CSS

I''m trying to apply styles to some HTML that I load from a string, but its not working. What am I doing wrong? The CSS file loads ok, so I am assuming there is something wrong in the way I am trying to do this. Here is a sample code fragment: Dim strHTMLText As New StringBuilder With strHTMLText .Append("") .Append("
This is a sample heading
") .Append("
This is a sample div.
") .Append("
This is another sample div.
") .Append("") End With htmlMessages.LoadFromString(strHTMLText.ToString) htmlMessages.LoadCSS("styles.css")

4 Replies

CC Chuck Cherry August 2, 2005 11:06 AM

OK, apparently the html tags in the previous post were stripped out, but they were there in the original... >I''m trying to apply styles to some HTML that I load from a string, but its not working. What am I doing wrong? The CSS file loads ok, so I am assuming there is something wrong in the way I am trying to do this. > >Here is a sample code fragment: > >Dim strHTMLText As New StringBuilder >With strHTMLText > .Append("") > .Append("
This is a sample heading
") > .Append("
This is a sample div.
") > .Append("
This is another sample div.
") > .Append("") >End With >htmlMessages.LoadFromString(strHTMLText.ToString) >htmlMessages.LoadCSS("styles.css") >


AD Administrator Syncfusion Team August 3, 2005 03:56 PM

Hi Charles, The CSS should be applied if it is loaded after the string has been loaded and from the code snippet you have posted, you are doing ir correctly. It would help if you post the CSS file you are using. I have linked to a sample application that loads CSS and loads HTML from a string: http://www.syncfusion.com/support/user/Uploads/F32504_HTMLUICSSLoadVB_6983.zip Please try this sample at your end also upload your CSS file so that I can take a look at it. Thanks, Davis


CP Carsten Pedersen August 25, 2005 01:52 AM

I''m trying the same in C# using your css file, and it does not work, please help? public Form1() { InitializeComponent(); htmluiControl1.ShowTitle = false; string elementText = "LoadCSS

This is a paragraph

"; this.htmluiControl1.LoadFromString(elementText); this.htmluiControl1.LoadCSS("style.css"); }


AD Administrator Syncfusion Team August 26, 2005 04:12 PM

Hi, What is the version of HTMLUI you are using. This has been fixed in version 3.3.0.0 I have created an incident under your account in DirectTrac and posted a link to download version 3.3.0.0 along with the key. Thanks, Davis

Loader.
Live Chat Icon For mobile
Up arrow icon