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

This read-only property lists child elements of this object.

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. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

This read-only property lists the parent of this document element.

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 the document element, specified as a character vector.

The DOM generates a session-unique tag when it creates the document element. Structure the tag as class:id, where class is the class of the element and id is the value of the Id property. You can specify a tag to replace the generated tag. Specifying your own tag can make it easier 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