创建章节
此示例演示了如何创建一个包含标题页的横向页面布局的章节。
您可以使用 mlreportgen.report.Chapter
类将章节添加到报告中。使用此类创建章节比使用 DOM 对象要容易得多,而且效率更高。Chapter
类继承自 mlreportgen.report.Section
。Chapter
类将格式化的章节添加到报告中。默认格式是纵向,带有页眉和页脚。页脚包含页码。您可以覆盖章节的布局。
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("My Report","pdf"); add(rpt,TitlePage("Title","My Report")); chapter = Chapter("Images"); chapter.Layout.Landscape = true; add(chapter,Section("Title","Boeing 747", ... "Content",Image("b747.jpg"))); add(rpt,chapter); close(rpt); rptview(rpt);