Main Content

mlreportgen.dom.CSSProperties class

Package: mlreportgen.dom
Superclasses:

Array of CSS properties for formatting HTML output

Description

Creates an object that contains one or more cascading style sheet (CSS) formats for HTML output. Specify the formats using mlreportgen.dom.CSSProperty. For information on CSS properties, see W3Schools.com/cssref.

Note

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

Construction

props = CSSProperties(prop) creates a CSSProperties object based on mlreportgen.dom.CSSProperty objects. The mlreportgen.dom.CSSProperty object specifies the CSS format and value.

Input Arguments

expand all

CSS property format, specified as an mlreportgen.dom.CSSProperty object or as an array or cell array of mlreportgen.dom.CSSProperty objects.

Output Arguments

expand all

CSS properties, returned as an mlreportgen.dom.CSSProperties object.

Properties

expand all

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Parent of this document element, specified as a DOM object. This property is read-only.

CSS properties, specified as an array of mlreportgen.dom.CSSProperty objects.

Tag for this document element, specified as a character vector or string scalar.

The DOM 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. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Examples

collapse all

This example uses a CSSProperties object to apply an HTML-specific list format, list-style-position, for which there is no DOM equivalent.

import mlreportgen.dom.*

d = Document('list-style-pos','html');

p = Paragraph('This list has list-style-position set to inside:');
append(d,p);
list = UnorderedList({'Earl Grey','Jasmine','Honeybush'});
list.Style = {CSSProperties(CSSProperty('list-style-position','inside'))};
append(d,list);

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

close(d);
rptview(d.OutputPath);
Introduced in R2016a