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.

LoadCSSFromString() equivalent

Thread ID:

Created:

Updated:

Platform:

Replies:

44444 May 23,2006 05:58 PM May 26,2006 05:11 PM Windows Forms 6
loading
Tags: HTMLUIControl
Eric Robishaw
Asked On May 23, 2006 05:58 PM

What if I want to load a CSS from string? i.e., set the inline of the document using a string, instead of from a file or resource? I suppose I could create a memoryStream and use the load from stream... is that the best way? For example: If I want to modify the "strong" tag, so that it''s color: blue. The Css tag for this is very easy to accomplish, but how do I set the document''s CSS to use this, other than LoadCSS.

Nandakumar R [Syncfusion]
Replied On May 25, 2006 05:45 AM

Hi, The HTMLUIControl supports the definition of inline styles with the help of the style attribute and the class attribute. You can add a style attribute to the html element at run time and apply the style of the specific html element as string. Please refer the sample attached below that shows how an inline style is applied in the form of string to an html element at run time with the help of the style attribute. [C#] private void LoadCSSFromString(IHTMLElement element, string CSSstyle) {  if(element.Attributes.Contains("style") == false)   element.Attributes.Add("style");  element.Attributes["style"].Value = CSSstyle; } Thank you for your interest in Essential HTMLUI. Regards, Nanda LoadCSSFromString.zip

Eric Robishaw
Replied On May 25, 2006 09:48 AM

You misunderstood my question. Clarification: Example: I have the following html in the control:
hello
I want to establish what the element looks like by setting an in-line style sheet:

So the question is: How do I set the inline-css style sheet?

Eric Robishaw
Replied On May 25, 2006 09:53 AM

OK... that post didn''t work right, it stripped my html tags. If I have a strong tag in my html BODY: Hello And I want to define, using header css style setting: The question is: How do I setup the css header? So that any use of the STRONG tag in the document displays as Blue text?

Nandakumar R [Syncfusion]
Replied On May 26, 2006 05:15 AM

Hi Eric, Converting the inline style string to Stream and applying it to the document in the HTMLUI control using the LoadCSS method, is the best way I can suggest for this. This can be done as shown below, 1) Convert the CSS header string to Stream as shown below, [C#] using System.IO; using system.Text; Stream str = new MemoryStream(ASCIIEncoding.Default.GetBytes("strong {color: blue}")); 2) Then load the converted stream CSS in the HTMLUI control by, [C#] using Syncfusion.Windows.Forms.HTMLUI; htmluiControl.LoadCSS(str); I have attached here a sample that shows how the CSS header is set at run time with a string using the above steps. Please try this and let me know if this helps. Thank you for your interest in Essential HTMLUI. Regards, Nanda

Nandakumar R [Syncfusion]
Replied On May 26, 2006 05:18 AM

Hi Eric, Sorry for that the sample have not been displayed in the above post. Please try the sample attached here and let me know if this helps. Thank you for your interest in Syncfusion products. Regards, Nanda LoadCSSFromString.zip

Eric Robishaw
Replied On May 26, 2006 05:11 PM

perfect. Thankx

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;