PowerPoint.SlideBackgroundFill class
スライドの背景オブジェクトの塗りつぶしの書式設定を表します。
- Extends
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Gets the background fill type of the first selected slide.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
const fill: PowerPoint.SlideBackgroundFill = slide.background.fill;
fill.load("type");
await context.sync();
const fillType = fill.type as PowerPoint.SlideBackgroundFillType;
console.log(`Background fill type: ${fillType}`);
});
プロパティ
| context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
| type | スライドの背景の塗りつぶしの種類を返します。 詳細については 、「PowerPoint.SlideBackgroundFillType 」を参照してください。 |
メソッド
| get |
グラデーション塗りつぶしのプロパティを取得します。 塗りつぶしの種類が |
| get |
パターン塗りつぶしプロパティを取得します。 塗りつぶしの種類が |
| get |
図またはテクスチャ塗りつぶしのプロパティを取得します。 塗りつぶしの種類が |
| get |
塗りつぶしプロパティを取得します。 塗りつぶしの種類が |
| load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| set |
スライドの背景の塗りつぶしの書式設定をグラデーションの塗りつぶしに設定します。 これにより、塗りつぶしの種類が |
| set |
スライドの背景の塗りつぶしの書式をパターン塗りつぶしに設定します。 これにより、塗りつぶしの種類が |
| set |
スライドの背景の塗りつぶしの書式設定を図またはテクスチャの塗りつぶしに設定します。 これにより、塗りつぶしの種類が |
| set |
スライドの背景の塗りつぶしの書式を塗りつぶしに設定します。 これにより、塗りつぶしの種類が |
| toJSON() | API オブジェクトが |
プロパティの詳細
context
オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。
context: RequestContext;
プロパティ値
type
スライドの背景の塗りつぶしの種類を返します。 詳細については 、「PowerPoint.SlideBackgroundFillType 」を参照してください。
readonly type: PowerPoint.SlideBackgroundFillType | "Unsupported" | "Solid" | "Gradient" | "PictureOrTexture" | "Pattern";
プロパティ値
PowerPoint.SlideBackgroundFillType | "Unsupported" | "Solid" | "Gradient" | "PictureOrTexture" | "Pattern"
注釈
メソッドの詳細
getGradientFillOrNullObject()
グラデーション塗りつぶしのプロパティを取得します。 塗りつぶしの種類が gradientされていない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。
getGradientFillOrNullObject(): PowerPoint.SlideBackgroundGradientFill;
返品
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Gets the gradient fill properties of the first selected slide's background.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
const fill: PowerPoint.SlideBackgroundFill = slide.background.fill;
fill.load("type");
await context.sync();
if (fill.type !== PowerPoint.SlideBackgroundFillType.gradient) {
console.warn("The slide background isn't a gradient fill.");
return;
}
const gradientFill: PowerPoint.SlideBackgroundGradientFill = slide.background.fill.getGradientFillOrNullObject();
gradientFill.load("type");
await context.sync();
if (gradientFill.isNullObject) {
console.warn("The slide background isn't a gradient fill.");
} else {
console.log("Gradient fill:", `- type: ${gradientFill.type}`);
}
});
getPatternFillOrNullObject()
パターン塗りつぶしプロパティを取得します。 塗りつぶしの種類が patternされていない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。
getPatternFillOrNullObject(): PowerPoint.SlideBackgroundPatternFill;
返品
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Gets the pattern fill properties of the first selected slide's background.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
const fill: PowerPoint.SlideBackgroundFill = slide.background.fill;
fill.load("type");
await context.sync();
if (fill.type !== PowerPoint.SlideBackgroundFillType.pattern) {
console.warn("The slide background isn't a pattern fill.");
return;
}
const patternFill: PowerPoint.SlideBackgroundPatternFill = slide.background.fill.getPatternFillOrNullObject();
patternFill.load(["foregroundColor", "backgroundColor", "pattern"]);
await context.sync();
if (patternFill.isNullObject) {
console.warn("The slide background isn't a pattern fill.");
} else {
console.log(
"Pattern fill:",
`- foregroundColor: ${patternFill.foregroundColor}`,
`- backgroundColor: ${patternFill.backgroundColor}`,
`- pattern: ${patternFill.pattern}`,
);
}
});
getPictureOrTextureFillOrNullObject()
図またはテクスチャ塗りつぶしのプロパティを取得します。 塗りつぶしの種類が pictureOrTextureされていない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。
getPictureOrTextureFillOrNullObject(): PowerPoint.SlideBackgroundPictureOrTextureFill;
返品
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Gets the picture or texture fill properties of the first selected slide's background.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
const fill: PowerPoint.SlideBackgroundFill = slide.background.fill;
fill.load("type");
await context.sync();
if (fill.type !== PowerPoint.SlideBackgroundFillType.pictureOrTexture) {
console.warn("The slide background isn't a picture or texture fill.");
return;
}
const pictureFill: PowerPoint.SlideBackgroundPictureOrTextureFill =
slide.background.fill.getPictureOrTextureFillOrNullObject();
pictureFill.load("transparency");
await context.sync();
if (pictureFill.isNullObject) {
console.warn("The slide background isn't a picture or texture fill.");
} else {
console.log("Picture or texture fill:", `- transparency: ${pictureFill.transparency}`);
}
});
getSolidFillOrNullObject()
塗りつぶしプロパティを取得します。 塗りつぶしの種類が solidされていない場合は、 isNullObject プロパティが true に設定されたオブジェクトが返されます。 詳細については、「 *OrNullObject メソッドとプロパティ」を参照してください。
getSolidFillOrNullObject(): PowerPoint.SlideBackgroundSolidFill;
返品
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Gets the solid fill properties of the first selected slide's background.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
const fill: PowerPoint.SlideBackgroundFill = slide.background.fill;
fill.load("type");
await context.sync();
if (fill.type !== PowerPoint.SlideBackgroundFillType.solid) {
console.warn("The slide background isn't a solid fill.");
return;
}
const solidFill: PowerPoint.SlideBackgroundSolidFill = slide.background.fill.getSolidFillOrNullObject();
solidFill.load(["color", "transparency"]);
await context.sync();
if (solidFill.isNullObject) {
console.warn("The slide background isn't a solid fill.");
} else {
console.log("Solid fill:", `- color: ${solidFill.color}`, `- transparency: ${solidFill.transparency}`);
}
});
load(options)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(options?: PowerPoint.Interfaces.SlideBackgroundFillLoadOptions): PowerPoint.SlideBackgroundFill;
パラメーター
読み込むオブジェクトのプロパティのオプションを提供します。
返品
load(propertyNames)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNames?: string | string[]): PowerPoint.SlideBackgroundFill;
パラメーター
- propertyNames
-
string | string[]
読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。
返品
load(propertyNamesAndPaths)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): PowerPoint.SlideBackgroundFill;
パラメーター
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列で、 propertyNamesAndPaths.expand は読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。
返品
setGradientFill(options)
スライドの背景の塗りつぶしの書式設定をグラデーションの塗りつぶしに設定します。 これにより、塗りつぶしの種類が gradientに変更されます。
setGradientFill(options?: PowerPoint.SlideBackgroundGradientFillOptions): void;
パラメーター
グラデーション塗りつぶしのオプション。
返品
void
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Sets the background of the first selected slide to a linear gradient fill.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
slide.background.fill.setGradientFill({
type: PowerPoint.SlideBackgroundGradientFillType.linear,
} as PowerPoint.SlideBackgroundGradientFillOptions);
await context.sync();
console.log("Background set to linear gradient fill.");
});
setPatternFill(options)
スライドの背景の塗りつぶしの書式をパターン塗りつぶしに設定します。 これにより、塗りつぶしの種類が patternに変更されます。
setPatternFill(options?: PowerPoint.SlideBackgroundPatternFillOptions): void;
パラメーター
パターン塗りつぶしのオプション。
返品
void
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Sets the background of the first selected slide to a diagonal cross pattern fill.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
slide.background.fill.setPatternFill({
foregroundColor: "#1F3864",
backgroundColor: "#D6E4F7",
pattern: PowerPoint.SlideBackgroundPatternFillType.diagonalCross,
} as PowerPoint.SlideBackgroundPatternFillOptions);
await context.sync();
console.log("Background set to diagonal cross pattern fill.");
});
setPictureOrTextureFill(options)
スライドの背景の塗りつぶしの書式設定を図またはテクスチャの塗りつぶしに設定します。 これにより、塗りつぶしの種類が pictureOrTextureに変更されます。
setPictureOrTextureFill(options?: PowerPoint.SlideBackgroundPictureOrTextureFillOptions): void;
パラメーター
図またはテクスチャ塗りつぶしのオプション。
返品
void
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Sets the background of the first selected slide to a picture fill at 60% transparency.
// Uses a sample image from a Base64-encoded string.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
slide.background.fill.setPictureOrTextureFill({
imageBase64: getSampleImageAsBase64String(),
transparency: 0.6,
} as PowerPoint.SlideBackgroundPictureOrTextureFillOptions);
await context.sync();
console.log("Background set to picture fill (60% transparent).");
});
setSolidFill(options)
スライドの背景の塗りつぶしの書式を塗りつぶしに設定します。 これにより、塗りつぶしの種類が solidに変更されます。
setSolidFill(options?: PowerPoint.SlideBackgroundSolidFillOptions): void;
パラメーター
塗りつぶしのオプション。
返品
void
注釈
[ API set: PowerPointApi 1.10 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-background-fill.yaml
// Sets the background of the first selected slide to a solid orange fill at 20% transparency.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
slide.background.fill.setSolidFill({
color: "#FF8C00",
transparency: 0.2,
} as PowerPoint.SlideBackgroundSolidFillOptions);
await context.sync();
console.log("Background set to solid orange fill (20% transparent).");
});
toJSON()
API オブジェクトがJSON.stringify()に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (JSON.stringify、それに渡されるオブジェクトの toJSON メソッドを呼び出します)。元の PowerPoint.SlideBackgroundFill オブジェクトは API オブジェクトですが、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( PowerPoint.Interfaces.SlideBackgroundFillData として型指定) を返します。
toJSON(): PowerPoint.Interfaces.SlideBackgroundFillData;