Main Content

mlreportgen.dom.VerticalAlign Class

Namespace: mlreportgen.dom

Vertical alignment of an inline document element

Description

Specifies the vertical alignment of an inline document element, such as a text or image object.

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

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

mlreportgen.dom.VerticalAlign = VerticalAlign specifies superscript alignment.

example

mlreportgen.dom.VerticalAlign = VerticalAlign(value) sets the Value property to the alignment specified by value.

example

Properties

expand all

Vertical alignment of an inline document element, specified as one of these values:

  • 'superscript' or 'super' — Aligns the element as superscript to the parent element.

  • 'subscript' or 'sub' — Aligns the element as subscript to the parent element.

  • 'baseline' — Aligns the baseline of the element with the baseline of the parent element.

  • 'text-top' — Aligns the top of the element with the top of the content area of the parent element. This value is not supported for Word documents.

  • 'text-bottom' — Aligns the bottom of the element with the bottom of the content area of the parent element. This value is not supported for Word documents.

  • length — amount by which the element is raised or lowered from the baseline of the parent element. Format the length as valueUnits where value is the number of units and Units is the unit abbreviation. Use one of the abbreviations in the table.

    Unit NameUnit Abbreviation
    pixels (not supported for Word documents)px
    centimeterscm
    inchesin
    millimetersmm
    picaspc
    pointspt
    percentage of the line height (not supported for Word documents)%

See the vertical-align property in the CSS specification.

If you do not provide a VerticalAlign object, the alignment defaults to the baseline alignment. If you provide a VerticalAlign object, but do not specify the alignment, the alignment defaults to the superscript alignment.

Example: 'text-top'

Example: '0.25in'

Example: '50%'

Object identifier for the mlreportgen.dom.VerticalAlign 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.VerticalAlign 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

Align text as superscript to the text in the parent paragraph. Creating a VerticalAlign object without providing an input argument sets the alignment to superscript.

import mlreportgen.dom.*; 
doctype = 'html';
d = Document('test',doctype);
p = Paragraph('e = mc');

t = Text('2');
t.Style = {VerticalAlign()};
append(p,t);
append(d,p);

close(d);
rptview('test',doctype);

Align the bottom of an image with the bottom of the surrounding text by specifying 'text-bottom'.

import mlreportgen.dom.*;
doctype = 'html';
d = Document('mydoc',doctype);

p = Paragraph('This image ');
p.FontSize = '20';
im = Image('image_to_align.png');
im.Style = {VerticalAlign('text-bottom')};
t = Text(' is aligned with the bottom of the surrounding text.');
append(p,im);
append(p,t);
append(d,p);

close(d);
rptview('mydoc',doctype);

More About

expand all

Version History

Introduced in R2014b