append
Class: mlreportgen.dom.Document
Namespace: mlreportgen.dom
Append DOM or MATLAB object to document
Syntax
Description
appends text or numbers to a document and returns a text object. In Microsoft® Word and PDF output, the text is wrapped in a paragraph because Word
and PDF do not permit unwrapped text to be added to the body of a document. In
HTML output, the text is not wrapped in a paragraph.domObjOut
= append(docObj
,textContent
)
appends an unordered list and returns an unordered list object.domObjOut
= append(docObj
,listContent
)
appends a table and returns a table object.domObjOut
= append(docObj
,tableContent
)
appends a paragraph, starts a new page layout section whose properties are
specified by the domObjOut
= append(docObj
,paraObj
,pageLayoutObj
)pageLayoutObject
, and returns a paragraph
object.
Input Arguments
Output Arguments
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');
Version History
Introduced in R2014b