Main Content

Create Title Pages

This example shows how to create a title page that uses default formatting.

You can add a title page to your report using the mlreportgen.report.TitlePage class. It is much easier and more efficient to use this class rather than using DOM objects to create and add a title page to your report. This class has predefined holes and formatting for the:

  • Title

  • Subtitle

  • Image

  • Author

  • Publisher

  • Publication date

You can exclude items you do not want on your title page and you can edit the TitlePage template to add more items.

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);

The report title page has the title, Aircraft Tests, subtitle, Monthly Data, an image of a Boeing 747, author, John Smith, publisher, MathWorks, and the date.

See Also