楕円
Contents
[
Hide
]
楕円の作成
このトピックでは、Aspose.Slides for C++ を使用してスライドに楕円形状を追加する方法を開発者に紹介します。Aspose.Slides for C++ は、数行のコードでさまざまな種類の形状を描画するための簡単なAPIセットを提供します。プレゼンテーションの選択したスライドにシンプルな楕円を追加するには、以下の手順に従ってください。
- Presentation class のインスタンスを作成します。
- インデックスを使用してスライドの参照を取得します。
- IShapesオブジェクトによって公開されるAddAutoShapeメソッドを使用して、楕円型のAutoShapeを追加します。
- 修正されたプレゼンテーションをPPTXファイルとして書き出します。
以下の例では、最初のスライドに楕円を追加しました。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C | |
// The path to the documents directory. | |
const String outPath = u"../out/SimpleEllipse.pptx"; | |
const String templatePath = u"../templates/HelloWorld.pptx"; | |
// Load the desired the presentation | |
SharedPtr<Presentation> pres = MakeObject<Presentation>(); | |
// Access first slide | |
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0); | |
// Add autoshape of ellipse type | |
SharedPtr<IAutoShape> ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50); | |
// Save PPTX to Disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |
フォーマットされた楕円の作成
スライドにより良くフォーマットされた楕円を追加するには、以下の手順に従ってください。
- Presentation class のインスタンスを作成します。
- インデックスを使用してスライドの参照を取得します。
- IShapesオブジェクトによって公開されるAddAutoShapeメソッドを使用して、楕円型のAutoShapeを追加します。
- 楕円の塗りつぶしタイプをソリッドに設定します。
- FillFormatオブジェクトと関連するIShapeオブジェクトによって公開されるSolidFillColor.Colorプロパティを使用して、楕円の色を設定します。
- 楕円のラインの色を設定します。
- 楕円のラインの幅を設定します。
- 修正されたプレゼンテーションをPPTXファイルとして書き出します。
以下の例では、プレゼンテーションの最初のスライドにフォーマットされた楕円を追加しました。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C | |
// The path to the documents directory. | |
const String outPath = u"../out/FormattedEllipse_out.pptx"; | |
const String templatePath = u"../templates/AltText.pptx"; | |
// Load the desired the presentation | |
SharedPtr<Presentation> pres = MakeObject<Presentation>(); | |
// Access first slide | |
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0); | |
// Add an autoshape of type line | |
SharedPtr<IAutoShape> shape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50); | |
// Set the fill color of the rectangle shape | |
shape->get_FillFormat()->set_FillType(FillType::Solid); | |
shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Chocolate()); | |
// Apply some formatting on the line | |
shape->get_LineFormat()->set_Style(LineStyle::ThickThin); | |
shape->get_LineFormat()->set_Width(5); | |
shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); | |
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); | |
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); | |
//Write the PPTX to Disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |