画像を追加

PowerPoint プレゼンテーションでは、テキストで要点を説明するビジュアルを組み込むことが、アイデアを表現し、有益なコンテンツを作成するための重要な柱となります。 画像などのビジュアルを追加すると、ユーザーはポイントをより効果的に説明できます。 さらに、スライド上の特定の場所、画像の角度、寸法を変更および設定する機能により、PowerPoint をさらにカスタマイズできます。

IronPPT を使用すると、すべてを 1 か所で実行できるため、開発者は PowerPoint プレゼンテーションに画像を配置する方法を完全にカスタマイズできます。

画像を追加するための5ステップコード

  • 画像 image = new Image();
  • image.LoadFromFile("sample.png");
  • var newImage = document.AddImage(image, 0);
  • newImage.Position = (200, 200);
  • newImage.Angle = 45;

コードの説明

目的の画像を読み込むには、まず新しいImageクラスをインスタンス化し、次にLoadFromFile使用して目的の画像を読み込みます。 Afterwards, we add the image to the PowerPoint presentation using AddImage, providing the loaded image as a parameter, as well as the slide index. In this example, we are adding the sample.png onto the first slide of the PowerPoint presentation.

After adding the image, we can specify its location on the slide by assigning the x and y coordinates of the image relative to the slide. In the example, we set Position to the x and y coordinates of 200.

画像の角度をさらにカスタマイズして変更するには、 Angleプロパティを使用して値を 45 に設定します。

IronPPT を使用して PowerPoint スライドを管理する方法を学びます。

準備はできましたか?
Nuget ダウンロード 3,325 | Version: 2025.11 リリース