メインコンテンツ

mlreportgen.ppt.BackgroundColor クラス

名前空間: mlreportgen.ppt

プレゼンテーション要素の背景色

説明

次のプレゼンテーション要素 PPT API オブジェクトの背景色を指定します。

  • TextBox

  • TextBoxPlaceholder

  • ContentPlaceholder

  • TablePlaceholder

  • Table

  • TableRow

  • TableEntry

  • ColSpec

  • TextBox

mlreportgen.ppt.BackgroundColor クラスは handle クラスです。

作成

説明

backgroundColorObj = BackgroundColor は、白の背景を作成します。

backgroundColorObj = BackgroundColor(color) は、指定された CSS の色名または 16 進数の RGB カラー値に基づいて背景色オブジェクトを作成します。

入力引数

すべて展開する

背景色。文字ベクトルまたは string スカラーとして指定します。以下を使用できます。

  • 色の名前。文字ベクトルまたは string スカラーとして指定します。名前は CSS の色の名前にしなければなりません。https://www.w3.org/wiki/CSS/Properties/color/keywords を参照してください。

  • 16 進数の RGB (赤、緑、青) のカラー値。文字ベクトルまたは string スカラーとして指定します。#RRGGBB の形式を使用します。最初の文字として # を使用し、赤、緑、および青の値にそれぞれ 2 桁の 16 進数を使用します。たとえば、"#0000ff" は青を指定します。

プロパティ

すべて展開する

色の名前。次の値のいずれかを使用し、文字ベクトルとして指定します。

  • CSS の色名。https://www.w3.org/wiki/CSS/Properties/color/keywords を参照してください。

  • RGB 値。#RRGGBB の形式の文字ベクトルを使用します。最初の文字として # を使用し、赤、緑、および青の値にそれぞれ 2 桁の 16 進数を使用します。たとえば、"#0000ff" は青を指定します。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

データ型: char | string

タグ。文字ベクトルまたは string スカラーとして指定します。PPT API は、このオブジェクトを作成するときに、セッション固有タグを生成します。生成されるタグの形式は CLASS:ID という形式です。ここで、CLASS はオブジェクト クラスです。ID はオブジェクトの Id プロパティの値です。この値を使用すると、ドキュメントの生成中に問題が発生した箇所を容易に特定できるようになります。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

データ型: char | string

オブジェクト識別子。文字ベクトルまたは string スカラーとして指定します。PPT API は、ドキュメント要素オブジェクトの作成時にセッション固有識別子を生成します。Id には独自の値を指定できます。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

データ型: char | string

すべて折りたたむ

行とテーブル エントリの色が異なるテーブルを作成します。

A Colorful Table というタイトルのスライドをもつプレゼンテーションを設定します。

import mlreportgen.ppt.*

ppt = Presentation("myBackground.pptx");
open(ppt);
slide1 = add(ppt,"Title and Content");
replace(slide1,"Title","A Colorful Table");

最初の行および 2 番目の行の最初のエントリに異なる色を指定して、テーブルを定義します。

table1 = Table();

row1 = TableRow();
row1.Style = {BackgroundColor("beige")};
row1entry1 = TableEntry();
p2 = Paragraph("Beige row");
append(row1entry1,p2);
row1entry2 = TableEntry();
p3 = Paragraph("More text");
append(row1entry2,p3);
append(row1,row1entry1);
append(row1,row1entry2);

row2 = TableRow();
row2entry1 = TableEntry();
row2entry1.Style = {BackgroundColor("yellow")};
p4 = Paragraph("yellow cell");
append(row2entry1,p4);
row2entry2 = TableEntry();
p5 = Paragraph("default white background");
append(row2entry2,p5);
append(row2,row2entry1);
append(row2,row2entry2);

append(table1,row1);
append(table1,row2);

スライド コンテンツをテーブルに置き換え、プレゼンテーションを生成し、myBackground プレゼンテーションを開きます。

replace(slide1,"Content",table1);
close(ppt); 
rptview(ppt);

Sample slide with the heading A Colorful Table. In the table, the table headers are beige, and the first body cell is highlighted in yellow, while the second cell has no background color.

バージョン履歴

R2020a で導入