Main Content

mlreportgen.dom.PageBreak class

Package: mlreportgen.dom

Page break in a Word or PDF report

Description

Use mlreportgen.dom.PageBreak to insert a page break anywhere in a Microsoft® Word or PDF report.

Tip

Use an mlreportgen.dom.PageBreakBefore object to force a page break before a specific paragraph. For example, use PageBreakBefore to force chapters to start on a new page.

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

Class Attributes

HandleCompatible
true
ConstructOnLoad
true

Creation

Description

example

break = mlreportgen.dom.PageBreak() creates a page break object.

Properties

expand all

Children of this DOM API object, specified as an array of DOM API objects.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Custom attributes of this element, specified as an array of mlreportgen.dom.CustomAttribute objects. Use custom attributes supported by the output format.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

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.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Parent of this DOM API object, specified as a DOM API object.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Format objects that specify the format of a document element.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Name of the style to apply from the style sheet, specified as a character vector or string scalar.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

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 of the Id property of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Methods

expand all

Examples

collapse all

This example shows how to insert a page break in a PDF report by using a PageBreak object.

Import the DOM API package so that you do not have to use long, fully qualified names.

import mlreportgen.dom.*;

Create a Document object and open it.

d = Document("mydoc","pdf");
open(d);

Create the first page consisting of a heading and some paragraphs.

h = Heading1("My First Heading");
append(d,h);
p = Paragraph("Here are some paragraphs.");
append(d,p);
for i = 1:5
append(d,clone(p));
end

Insert a page break by using a PageBreak object.

br = PageBreak();
append(d,br);

In the newly created second page, append some paragraphs.

p2 = Paragraph("Here are some paragraphs after the forced page break.");
append(d,p2);
for i = 1:5
append(d,clone(p2));
end

Close and view the document.

close(d);
rptview(d);
Introduced in R2016a