Main Content

append

Class: mlreportgen.dom.Paragraph
Package: mlreportgen.dom

Append content to paragraph

Description

example

textObjOut = append(paraObj,text) creates a text object containing the specified text and appends it to a paragraph.

example

textObjOut = append(paraObj,text,styleName) creates and appends a text object using the specified style.

example

domObjOut = append(paraObj,domObj) appends a document element object, such as an image, to a paragraph.

Examples

expand all

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

para = Paragraph('Results: ');
append(d,para);
append(para,'Study 1');

close(d);
rptview(d.OutputPath);
import mlreportgen.dom.*;
doc = Document('mydoc','docx');

para = Paragraph('Results: ','Title');
para.WhiteSpace = 'pre';
append(doc,para);
append(para,'Study 2');

close(doc);
rptview('mydoc','docx');
import mlreportgen.dom.*;
docLink = Document('mydocLink','html');

mathWorksLink = ExternalLink...
   ('https://www.mathworks.com/','MathWorks site');
para = Paragraph('Go to the ');
append(para, mathWorksLink);
append(docLink,para);

close(docLink);
rptview(docLink.OutputPath);

Input Arguments

expand all

Paragraph to append content to, specified as an mlreportgen.dom.Paragraph object.

Text to append to the paragraph, specified as a character vector.

Name of the style to define the appearance of the text. Use a style that is in the style sheet of the document that contains the paragraph.

You can append the following types of document element object to a paragraph:

  • mlreportgen.dom.ExternalLink

  • mlreportgen.dom.Image

  • mlreportgen.dom.InternalLink

  • mlreportgen.dom.LinkTarget

  • mlreportgen.dom.Text

  • mlreportgen.dom.CustomElement

    If you specify a custom element, it must be a valid HTML or Word child of the paragraph, based on the document output type.

Output Arguments

expand all

Text appended to a paragraph, represented by an mlreportgen.dom.Text object.

Document element appended to paragraph, specified as a DOM object.

Introduced in R2014b