add
Class: mlreportgen.report.Section
Namespace: mlreportgen.report
(Not recommended) Add content to section
Syntax
add(section,content)
Description
Note
add is not recommended. Use append instead. See Version History.
add(
adds the specified content to the specified section.section,content)
Input Arguments
Section of the report, specified as an mlreportgen.report.Section object.
Content to add to the section, specified as one of these values:
Report API reporter
DOM object
Built-in MATLAB® object (most built-in MATLAB objects can be added to a
Sectionreporter)Cell array of objects that can be added individually to a section
Examples
Add content to a paragraph and add the paragraph to a section
of a chapter. To add the content to the paragraph, you must use
append because a paragraph is a DOM API object. To add the
paragraph to the section, the section to the chapter, and the chapter to the
report, this example uses add. Starting in R2020b, you can use
append instead of add. See Version History.
import mlreportgen.dom.* import mlreportgen.report.* rpt = Report("My Report"); ch = Chapter("My Chapter"); s = Section("My Section"); p = Paragraph("My paragraph content "); append(p,"and some more content."); add(s,p); add(ch,s); add(rpt,ch); close(rpt); rptview(rpt);
Version History
Introduced in R2017bStarting in R2020b, use the append method instead of the
add method to add content to objects of these Report API classes:
mlreportgen.report.Reportmlreportgen.report.Chaptermlreportgen.report.Sectionslreportgen.report.Report
To add content to a DOM API object, such as an
mlreportgen.dom.Paragraph object, continue to use the
append method of the DOM object. The advantage of using
append to add content to Report API objects is that you use
the same method name as you use to add content to DOM API objects.
There are no plans to remove the add methods of the
Report, Chapter, or Section
classes. Report API programs that use the add methods will continue
to run.
To update existing code, replace the method name add with
append as shown by the examples in the table.
| Not Recommended | Recommended |
|---|---|
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("My Report","pdf"); ch = Chapter("My Chapter"); sect = Section("My Section"); para = Paragraph("My Content "); append(para,"more Content"); add(sect,para); add(ch,sect); add(rpt,ch); close(rpt); rptview(rpt); |
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("My Report","pdf"); ch = Chapter("My Chapter"); sect = Section("My Section"); para = Paragraph("My Content "); append(para,"more Content"); append(sect,para); append(ch,sect); append(rpt,ch); close(rpt); rptview(rpt); |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)