Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.PageRef class

Package: mlreportgen.dom
Superclasses:

Create placeholder for reference to page number of link target

Description

Create a placeholder for a reference to the page number of a link target. This object applies only to Word and PDF output. For Word output, opening a document causes Word to replace this object with the page number of the link target that this object specifies. For PDF output, the DOM API replaces this object with the page number of the link target that it specifies.

Tip

Use this object to generate page references, such as "See page 15 for more information."

Construction

pageRef = PageRef(target) creates a page reference object that refers to the specified LinkTarget object. Generating the output replaces this PageRef object with the number of the page that contains the specified target.

Input Arguments

expand all

Name of the link target to reference, specified as a character vector. Specify the target using a LinkTarget object.

Output Arguments

expand all

Name of link target to reference, returned as an mlreportgen.dom.PageRef object. This PageRef object is replaced with the number of the page containing the specified LinkTarget 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 document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Name of the target of this page reference, specified as a character vector.

Methods

Method

Purpose

clone

Copy this object.

Examples

expand all

This example inserts a page number reference to a target on another page. Add a target mytarget using LinkTarget. Use PageRef to refer to the page that contains the target mytarget.

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

% Create page footer and add page number to it
footer = PDFPageFooter('default');
d.CurrentPageLayout.PageFooters = footer;
d.CurrentPageLayout.FirstPageNumber = 1;
pageno = Paragraph();
pageno.HAlign = 'center';
append(pageno,Page());
append(footer,pageno);

% Add target to heading object and append heading and para text to document
h = Heading1(LinkTarget('mytarget'));
append(h,'Head Whose Page to Reference');
p = Paragraph('Here is some paragraph text.');
append(d,h);
append(d,p);

% Add another page and insert page reference to target
p1 = Paragraph('The following paragraph contains the page reference.');
p1.Style = {PageBreakBefore(true)};
p2 = Paragraph('See Page ');
p2.WhiteSpace = 'preserve';
ref = PageRef('mytarget');
append(p2,ref);
append(p2,'.');
append(d,p1);
append(d,p2);

close(d);
rptview(d.OutputPath);

Introduced in R2016a

Was this topic helpful?