Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.CSSProperty class

Package: mlreportgen.dom
Superclasses:

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.com/cssref/.

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.

Construction

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

Input Arguments

expand all

CSS property name, specified as a character vector.

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

Output Arguments

expand all

CSS format object, returned as an mlreportgen.dom.CSSProperty object.

Properties

expand all

This read-only property lists child elements of this object.

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

CSS property name, specified as a character vector.

This read-only property lists the parent of this document element.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

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

Examples

expand 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);

Introduced in R2016a

Was this topic helpful?