線
Contents
[
Hide
]
平面線を作成する
プレゼンテーションの選択したスライドにシンプルな平面線を追加するには、以下の手順に従ってください。
- Presentation classのインスタンスを作成します。
- インデックスを使用してスライドの参照を取得します。
- Shapesオブジェクトによって公開された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/AddPlainLineToSlide_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::Line, 50, 150, 300, 0); | |
//Write the PPTX to Disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |
矢印形線を作成する
Aspose.Slides for C++では、開発者が線のいくつかのプロパティを設定して、より魅力的に見せることもできます。線を矢印のように見せるために、いくつかのプロパティを設定してみましょう。以下の手順に従ってください。
- Presentation classのインスタンスを作成します。
- インデックスを使用してスライドの参照を取得します。
- Shapesオブジェクトによって公開されたAddAutoShapeメソッドを使用して、線タイプのAutoShapeを追加します。
- Aspose.Slides for C++が提供するスタイルの1つに線のスタイルを設定します。
- 線の幅を設定します。
- 線のダッシュスタイルをAspose.Slides for C++が提供するスタイルの1つに設定します。
- 線の開始点の矢印ヘッドスタイルと長さを設定します。
- 線の終了点の矢印ヘッドスタイルと長さを設定します。
- 修正されたプレゼンテーションを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/AddArrowShapedLineToSlide_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::Line, 50, 150, 300, 0); | |
// Apply some formatting on the line | |
shape->get_LineFormat()->set_Style(LineStyle::ThickBetweenThin); | |
shape->get_LineFormat()->set_Width(10); | |
shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); | |
shape->get_LineFormat()->set_BeginArrowheadLength(LineArrowheadLength::Short); | |
shape->get_LineFormat()->set_BeginArrowheadStyle(LineArrowheadStyle::Oval); | |
shape->get_LineFormat()->set_EndArrowheadLength(LineArrowheadLength::Long); | |
shape->get_LineFormat()->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); | |
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); | |
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Maroon()); | |
//Write the PPTX to Disk | |
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); | |