EditLive! 9 Documentation : setStyles Method

This property specifies the styles rules to be contained in the <STYLE> element within the <HEAD> section of the document in EditLive!.

Syntax

Visual Basic Script
object.Styles = strStyles
ASP.NET
prefix:EditLiveJava Styles = strStyles
JavaScript
editliveInstance.setStyles(strStyles); 

Parameters

strStyles

A string specifying the style rules to be loaded into a <STYLE> element in the <HEAD> section of the document within the EditLive! applet.

Examples

The following code would set the initial style rules of the document within EditLive! to be equal to

"p.msonormal  { font-size: 12pt; margin: 0cm 0cm 0pt; font-family: 'times new roman' } h1 } font-weight: bold; font-size: 12pt; margin-left: 0cm; color: black; margin-right: 0cm; font-family: helvetica )}" 

. This style information will be used to render the contents of EditLive! and will only be visible in the Code View.

VBScript
editlive1.Styles = "p.msonormal { font-size: 12pt; margin: 0cm 0cm 0pt; font-family: 'times new roman' } 
h1 { font-weight: bold; font-size: 12pt; margin-left: 0cm; color: black; margin-right: 0cm; font-family: helvetica }")
ASP.NET Server Control
<elj:EditLiveJava 
  ...
  Styles="p.msonormal { font-size: 12pt; margin: 0cm 0cm 0pt; font-family: 'times new roman' } 
h1 { font-weight: bold; font-size: 12pt; margin-left: 0cm; color: black; margin-right: 0cm; font-family: helvetica }" 
  ...
/> 
JavaScript
var editlive1;
editlive1 = new EditLiveJava("ELApplet1","600","400");
editlive1.setBody(encodeURI("<p>Initial contents of Ephox EditLive!</p>")); 
editlive1.setStyles(encodeURI("p.msonormal { font-size: 12pt; margin: 0cm 0cm 0pt; font-family: 'times new roman' } 
h1 { font-weight: bold; font-size: 12pt; margin-left: 0cm; color: black; margin-right: 0cm; font-family: helvetica }"));

The string passed to the JavaScript setStyles property must be URL encoded. It is recommended that a server-side URL encoding function be used if available as the JavaScript URL encoding functions do not fully comply with the URL encoding standard.

See Also