mlreportgen.dom.PageBreak class

Package: mlreportgen.dom
Superclasses:

Create page break object

Description

Creates a page break object that you can insert in a Microsoft® Word or PDF report. Use PageBreak to insert a page break anywhere in a report.

Tip

Use the PageBreakBefore format to force a page break before a specific paragraph. For example, use PageBreakBefore to force chapters to start on a new page.

Construction

break = PageBreak() creates a page break object.

Output Arguments

expand all

Page break, returned as an mlreportgen.dom.PageBreak object.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

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

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.

Parent of this document element, specified as a DOM object. This property is read-only.

Format objects that specify the format of a document element.

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

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.

Methods

Method

Purpose

clone

Copy this object.

Examples

collapse all

This example shows how to force a page break by inserting a PageBreak object into a PDF report.

import mlreportgen.dom.*;
d = Document('mydoc','pdf');
open(d);

% Create first page
h = Heading1('My First Head');
p = Paragraph('Here are some paragraphs.');
append(d,h);
append(d,p);
append(d,clone(p));
append(d,clone(p));
append(d,clone(p));
append(d,clone(p));
append(d,clone(p));

% Create and append the page break object
br = PageBreak();
append(d,br);

% Create paragraphs that appear on the page after the break
p2 = Paragraph('Here are some paragraphs after the forced page break.');
append(d,p2);
append(d,clone(p2));
append(d,clone(p2));
append(d,clone(p2));
append(d,clone(p2));

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