创建标题页
此示例演示了如何创建使用默认格式的标题页。
您可以使用 mlreportgen.report.TitlePage
类为您的报告添加标题页。使用此类比使用 DOM 对象来创建和添加报告标题页更加容易且高效。此类具有预定义的空位和格式:
标题
副标题
图像
作者
发布者
发布日期
您可以排除标题页上不需要的项目,也可以编辑 TitlePage
模板以添加更多项目。
import mlreportgen.report.* rpt = Report("output","pdf"); tp = TitlePage(); tp.Title = "Aircraft Tests"; tp.Subtitle = "Monthly Data"; tp.Image = "b747.jpg"; tp.Author = "John Smith"; tp.Publisher = "MathWorks"; tp.PubDate = date(); add(rpt,tp); close(rpt); rptview(rpt);