主要内容

mlreportgen.dom.PageRef class

Package:mlreportgen.dom
Superclasses:

Create placeholder for reference to page number of link target

描述

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

使用此对象生成页面引用,例如“有关更多信息,请参见第15页”。

Construction

Pageref= PageRef(target)creates a page reference object that refers to the specifiedlinktarget目的。Generating the output replaces thisPageRef对象,包含指定目标的页面数。

Input Arguments

expand all

链接目标的名称为参考,指定为字符向量。使用A指定目标linktarget目的。

Output Arguments

expand all

链接目标的名称为参考,返回为mlreportgen.dom.PageRef目的。ThisPageRef对象被包含指定的页面数替换linktarget目的。

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 ofmlreportgen.dom.customattribute对象. 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.

该文档元素的父,指定为DOM对象。此属性仅阅读。

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.

标签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 theId对象的属性。指定自己的标签值可以帮助您确定文档生成期间问题的位置。

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

方法

Method

Purpose

clone

复制此对象。

Examples

collapse all

This example inserts a page number reference to a target on another page. Add a targetmytargetusinglinktarget. UsePageRef参考包含目标的页面mytarget.

importmlreportgen.dom.*;d =文档('mydoc','pdf');open(d);% Create page footer and add page number to it页脚= pdfpagefooter('默认');d.CurrentPageLayout.PageFooters = footer; d.CurrentPageLayout.FirstPageNumber = 1; pageno = Paragraph(); pageno.HAlign ='center';append(Pageno,page());附加(页脚,Pageno);% Add target to heading object and append heading and para text to documenth = heading1(linktarget(linktarget)('mytarget')); append(h,“要参考的页面”);p =段落(“这是一些段落文字。”);append(d,h); append(d,p);% Add another page and insert page reference to targetp1 =段('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