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.Document.append

Package: mlreportgen.dom

Append DOM or MATLAB object to document

Syntax

domObjOut = append(docObj,textContent)
domObjOut = append(docObj,listContent)
domObjOut = append(docObj,tableContent)
domObjOut = append(docObj,MATLABTable)
domObjOut = append(___,styleName)
domObjOut = append(docObj,domObj)

Description

domObjOut = append(docObj,textContent) appends text or numbers to a document and returns a text element object.

domObjOut = append(docObj,listContent) appends an unordered list and returns an unordered list object.

example

domObjOut = append(docObj,tableContent) appends a table and returns a table object.

example

domObjOut = append(docObj,MATLABTable) appends a MATLAB® table and returns an mlreportgen.dom.MATLABTable object.

example

domObjOut = append(___,styleName) appends the specified content, using the specified style.

example

domObjOut = append(docObj,domObj) appends a DOM object to the document and returns that object.

Examples

Append an Ordered List Object

Create an OrderedList object and append it to a report.

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

ol = OrderedList({'first step' 'second step' 'last step'});
append(d,ol);

close(d);
rptview('mydoc','html');

Specify a Style for Appended Text

Use the Word Title style for the text.

import mlreportgen.dom.*;
d = Document('mydoc','docx');
append(d,'This Is a Title','Title');
close(d);
rptview('mydoc','docx');

Append a MATLAB Table

% Create a MATLAB table named patients from workspace variables. 
load patients;
BloodPreasure = [Systolic Diastolic];
patients = table(Gender,Age,Smoker,BloodPreasure);
patients.Properties.RowNames = LastName;

% Sort the table based on the Age variable. 
sorted = sortrows(patients,'Age');

% Create a report with the sorted patients table 
rpt = mlreportgen.dom.Document('MyFileName','pdf');
append(rpt,sorted);
close(rpt);

% Show the PDF report in the viewer
rptview(rpt.OutputPath);

Append a Cell Array as a Table

import mlreportgen.dom.*;
d = Document('mydoc');
table = append(d,{'row 1 - col 1' 'row 1 - col 2';...
    'row 2 - col 1' 'row 2 - col 2'});
table.Style = {Border('double'),ColSep('solid'),RowSep('solid')};
close(d);
rptview('mydoc','html');

Input Arguments

collapse all

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

MATLAB table to append to document.

Output Arguments

collapse all

Appended object returned. They type of object depends on the second input type.

MATLAB table to append to document.

Introduced in R2014b

Was this topic helpful?