Main Content

append

Class: mlreportgen.dom.LinkTarget
Namespace: mlreportgen.dom

Append content to link target

Description

textObj = append(targetObj,text) converts text to an mlreportgen.dom.Text object, appends the text to the link target, and returns the text object.

example

textObj = append(targetObj,text,styleName) converts text to an mlreportgen.dom.Text object, appends the text to the link target, and returns the text object.

textObj = append(targetObj,textObj) appends the content of an mlreportgen.dom.Text object.

autoNumberObj = append(targetObj,autoNumberObj) appends an automatically generated number to the link target.

example

Examples

expand all

This example creates a two-page document with a link to a target at the top of the document.

Create a link target 'home' and append text to it. After a page break, create a link to the target, using InternalLink. The text for the link is Go to top.

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

target = LinkTarget('home');
append(target,' - top of page');
append(d,target);

p = Paragraph('This is another paragraph');
p.Style = {PageBreakBefore(true)};
append(d,p);

append(d,InternalLink('home','Go to top'));

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

This example creates a two-page document with an autonumber appended to the link target.

Create a paragraph and define an autonumber. Append the autonumber to the target and append the target to the paragraph. After the page break, create a link to the target.

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

p = Paragraph('Chapter ');
p.Style = {CounterInc('chapter'),WhiteSpace('preserve')};
number = AutoNumber('chapter');
target = LinkTarget('chapno');
append(target,number);
append(p,target);
append(d,p);

p = Paragraph('Paragraph on another page');
p.Style = {PageBreakBefore(true)};
append(d,p);

append(d,InternalLink('target','Chapter reference'));

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

Input Arguments

expand all

Link target to append content to, specified as an mlreportgen.dom.LinkTarget object.

Text to append, specified as a character vector or string scalar.

Name of style, specified as a character vector or string scalar.

Text object containing the text to append, specified as an mlreportgen.dom.Text object.

Automatically generated number, specified as an mlreportgen.dom.AutoNumber object.

Output Arguments

expand all

Text object, represented by an mlreportgen.dom.Text object.

Automatically generated number for link target, returned as an mlreportgen.dom.AutoNumber object.

Version History

Introduced in R2014b