خط

إنشاء خط بسيط

لإضافة خط بسيط إلى شريحة مختارة من العرض التقديمي، يرجى اتباع الخطوات أدناه:

  • إنشاء مثيل من فئة Presentation.
  • الحصول على مرجع لشريحة باستخدام الفهرس الخاص بها.
  • إضافة شكل تلقائي من نوع خط باستخدام AddAutoShape الذي تعرضه كائنات أشكال.
  • كتابة العرض التقديمي المعدل كملف PPTX.

في المثال الموضح أدناه، قمنا بإضافة خط إلى الشريحة الأولى من العرض التقديمي.

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 لـ C++ أيضًا للمطورين بتكوين بعض خصائص الخط لجعله يبدو أكثر جاذبية. دعنا نحاول تكوين بعض خصائص خط لجعله يبدو مثل سهم. يرجى اتباع الخطوات أدناه للقيام بذلك:

  • إنشاء مثيل من فئة Presentation.
  • الحصول على مرجع لشريحة باستخدام الفهرس الخاص بها.
  • إضافة شكل تلقائي من نوع خط باستخدام طريقة AddAutoShape التي تعرضها كائنات أشكال.
  • تعيين نمط الخط إلى أحد الأنماط المقدمة من Aspose.Slides لـ C++.
  • تعيين عرض الخط.
  • تعيين نمط الخط المتقطع للخط إلى أحد الأنماط المقدمة من Aspose.Slides لـ C++.
  • تعيين نمط رأس السهم وطول نقطة بداية الخط.
  • تعيين نمط رأس السهم وطول نقطة نهاية الخط.
  • كتابة العرض التقديمي المعدل كملف PPTX.
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);