メインコンテンツ

タイトル ページの作成

この例では、既定の書式設定を使用するタイトル ページを作成する方法を示します。

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

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.

参考