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
Properties
Value
— Vertical alignment
character vector
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
wherevalue
is the number of units andUnits
is the unit abbreviation. Use one of the abbreviations in the table.Unit Name Unit Abbreviation pixels (not supported for Word documents) px
centimeters cm
inches in
millimeters mm
picas pc
points pt
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%'
Id
— Object identifier for mlreportgen.dom.VerticalAlign
object
character vector | string scalar
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
— Tag for mlreportgen.dom.VerticalAlign
object
character vector | string scalar
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
Vertically Align Text as Superscript
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 Image with Bottom of Text
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
content area
Area of an element that contains text and images, not including padding, borders, and margins.
The content area dimensions depend on the font and other factors and can vary by implementation. See content area height in the CSS specification.
Version History
Introduced in R2014b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)