Main Content

mlreportgen.dom.Hyphenation class

Package: mlreportgen.dom

Enable hyphenation

Description

Use an object of the mlreportgen.dom.Hyphenation class to specify the hyphenation behavior for paragraphs and table cells. A Hyphenation object affects only a PDF report.

By default, hyphenation is disabled for paragraphs and table cells. When hyphenation is disabled, where possible, a line break occurs between words. When necessary to prevent overflow, a line break may occur anywhere in a word.

When hyphenation is enabled, a line break occurs at the end of a syllable and a hyphenation character is inserted. If a table cell contains a long sequence of numbers or letters that have no clear syllable breaks, overflow can occur. The table stretches to accommodate the overflow.

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

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

h = mlreportgen.dom.Hyphenation() enables hyphenation and sets the Value property to '-'.

example

h = mlreportgen.dom.Hyphenation(type) specifies whether to hyphenate and the hyphenation character to use.

Input Arguments

expand all

Type of hyphenation, specified as one of these values:

  • true — Enables hyphenation and sets the Value property to '-'.

  • '-' — Enables hyphenation and sets the Value property to '-'.

  • ' ' — Enables hyphenation and sets the Value property to a space (' ').

  • false — Disables hyphenation and sets the Value property to [].

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.

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.

Hyphenation character, specified as one of these values:

  • true — Enables hyphenation and uses a hyphen (-) for the hyphenation character.

  • '-' — Enables hyphenation and uses a hyphen (-) for the hyphenation character.

  • ' ' — Enables hyphenation and uses a space for the hyphenation character.

  • false — Disables hyphenation.

  • [] — Disables hyphenation.

Examples

collapse all

To enable hyphenation in a PDF table, add a Hyphenation object to the TableEntriesStyle property of the mlreportgen.dom.Table object. Use the default hyphenation character, '-'.

import mlreportgen.dom.*

d = Document('myreport','pdf');

open(d);

data = '/mylongpath/hyphenation/example/myveryveryveryverylongpathname.doc';
table = Table({data});
table.Width = '2in'; 
table.TableEntriesStyle = {Hyphenation(true)};
append(d,table);

close(d);
rptview(d);

Compatibility Considerations

expand all

Behavior changed in R2020b

Introduced in R2016b