Line break in a Word or PDF report
Use an object of
mlreportgen.dom.LineBreak to insert a line break
anywhere in a Microsoft® Word or PDF report.
mlreportgen.dom.LineBreak class is a
For information on class attributes, see Class Attributes.
creates a line break object.
lBreak = mlreportgen.dom.LineBreak()
Children— Children of this DOM API object
Children of this DOM API object, specified as an array of DOM API objects.
CustomAttributes— Custom attributes of this element
Custom attributes of this element, specified as an array of
mlreportgen.dom.CustomAttribute objects. Use custom attributes
supported by the output format.
Id— ID for this DOM API object
ID for this DOM API object, 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— Parent of this DOM API object
Parent of this DOM API object, specified as a DOM API object.
Style— Text formatting
Format objects that specify the format of a document element.
StyleName— Style to apply from style sheet
Name of the style to apply from the style sheet, specified as a character vector or string scalar.
Tag— Tag for this DOM API object
Tag for this DOM API object, 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
Id property of the object. Specifying your own tag value can
help you to identify where an issue occurred during document generation.
This example shows how to insert a line break in a PDF report by using a
Import the DOM API package so you do not have to use long, fully qualified names.
Document object and open it.
d = Document("LineBreakReport","pdf"); open(d);
Create the first page and add a heading to the object. Create a
h = Heading1("Learning to Use Line Breaks"); append(d,h); p = Paragraph("Use a LineBreak object");
preserve for the
WhiteSpace method for the
Paragraph object to add a line break to it. Append the LineBreak handle class to the paragraph.
p.WhiteSpace = 'preserve'; append(p,LineBreak);
Insert the next line by appending it to the existing
Paragraph object. Append the paragraph to the D
append(p,"to force a new line in a paragraph"); append(d,p);
Close and view the document.