Main Content

mlreportgen.dom.CSSProperty Class

Namespace: mlreportgen.dom

CSS property object for formatting HTML output

Description

Create a format object that specifies a cascading style sheet (CSS) property and value. Use the format object with mlreportgen.dom.CSSProperties to apply CSS properties to objects for HTML output. For information on CSS properties, see W3Schools CSS Reference.

Note

Use CSSProperty objects only for formats not supported by DOM format object. Most DOM format objects work for any output type. Using CSSProperty objects makes your report application specific to HTML output.

The mlreportgen.dom.CSSProperty class is a handle class.

Creation

Description

prop = CSSProperty(Name,Value) creates a CSS format property that has the specified name and value.

example

Input Arguments

expand all

CSS property name, specified as a character vector or string scalar.

Property value for the corresponding property name, specified as a character vector or string scalar.

Properties

expand all

Document element name, specified as a character vector or string scalar.

Attributes:

NonCopyable
true

Data Types: char | string

Property value for corresponding property name, specified as a character vector or string scalar.

Data Types: char

Parent of mlreportgen.dom.CSSProperty object, specified as a document element object. A document element must have only one parent.

Attributes:

SetAccess
private
NonCopyable
true

Children of mlreportgen.dom.CSSProperty object, specified as an array of document element objects. This property contains the document element objects appended using the append method.

Attributes:

SetAccess
private
NonCopyable
true

Object identifier for the mlreportgen.dom.CSSProperty object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Tag for the mlreportgen.dom.CSSProperty object, specified as a character vector or string scalar. The DOM API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

Create the CSSProperty objects inlist and outlist. When you create a list, you can use the CSSProperty object as a value to CSSProperties on the list.

import mlreportgen.dom.*

d = Document('List Styles','html');

inlist = CSSProperty('list-style-position','inside');
outlist = CSSProperty('list-style-position','outside');
p = Paragraph('The following list has list-style-position set to inside:');
append(d,p);

list = UnorderedList({'Earl Grey','Jasmine','Honeybush'});
list.Style = {CSSProperties(inlist)};
append(d,list);

p = Paragraph('The following list has list-style-position set to outside:');
append(d,p);
list = clone(list);
list.Style = {CSSProperties(outlist)};
append(d,list);

close(d);
rptview(d.OutputPath);

Version History

Introduced in R2016a