PNG JPG BMP TIFF PPT
Aspose.Slides  for C++

แผนภูมิรูปแบบ PPT ใน C ++

แผนภูมิเอกสาร PPT ดั้งเดิมและประสิทธิภาพสูงโดยใช้ Aspose.Slides ฝั่งเซิร์ฟเวอร์สำหรับ C++ API โดยไม่ต้องใช้ซอฟต์แวร์ใดๆ เช่น Microsoft หรือ Adobe PDF

วิธีสร้างแผนภูมิไฟล์ PPT โดยใช้ C ++

ในการค้นหาไฟล์ PPT เราจะใช้

Aspose.Slides สำหรับ C++

API ซึ่งเป็น API ที่มีคุณลักษณะหลากหลาย มีประสิทธิภาพ และใช้งานง่ายในการค้นหาเอกสารสำหรับแพลตฟอร์ม C++ คุณสามารถดาวน์โหลดเวอร์ชันล่าสุดได้โดยตรง เพียงแค่เปิด

NuGet

package manager ค้นหา Aspose.Slides.Cpp และติดตั้ง คุณยังสามารถใช้คำสั่งต่อไปนี้จาก Package Manager Console

สั่งการ


PM> Install-Package Aspose.Slides.Cpp

ขั้นตอนในการสร้างแผนภูมิไฟล์ PPT ใน C++

การสร้างแผนภูมิเอกสารพื้นฐานด้วย API ของ Aspose.Slides for C++ สามารถทำได้โดยใช้โค้ดเพียงไม่กี่บรรทัด

  1. ยกตัวอย่างคลาสการนำเสนอ

  2. เข้าถึงสไลด์แรก

  3. เพิ่มแผนภูมิด้วยข้อมูลเริ่มต้น

  4. กำหนดดัชนีของแผ่นข้อมูลแผนภูมิ

  5. รับสมุดงานข้อมูลแผนภูมิ

  6. ตั้งชื่อแผนภูมิ

  7. ลบซีรี่ส์และหมวดหมู่ที่สร้างโดยค่าเริ่มต้น

  8. เพิ่มซีรีส์และหมวดหมู่

  9. ใช้แผนภูมิชุดแรกและเติมข้อมูล

  10. ตั้งค่าสีเติมสำหรับซีรี่ส์

  11. บันทึกไฟล์ PPT

ความต้องการของระบบ

Aspose.Slides สำหรับ C ++ รองรับบนแพลตฟอร์มหลักและระบบปฏิบัติการทั้งหมด โปรดตรวจสอบให้แน่ใจว่าคุณมีข้อกำหนดเบื้องต้นดังต่อไปนี้

  • Microsoft Windows หรือ OS ที่เข้ากันได้กับ C++ Runtime Environment สำหรับ Windows 32 บิต, Windows 64 บิต และ Linux 64 บิต
  • Aspose.Slides สำหรับ C ++ DLL ที่อ้างอิงในโครงการของคุณ
 

สร้างแผนภูมิไฟล์ PPT - C++

// Output File Path.
const String outputFilePath = u"OutputDirectory\\column_chart.ppt";

// Instantiate Presentation class
SharedPtr<Presentation> pres = MakeObject<Presentation>();

// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);

// Add chart with default data
SharedPtrv<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::ClusteredColumn, 0, 0, 500, 500);

// Setting the index of chart data sheet
int defaultWorksheetIndex = 0;

// Getting the chart data workbook
SharedPtr<IChartDataWorkbook> fact = chart->get_ChartData()->get_ChartDataWorkbook();

// Setting chart Title
chart->get_ChartTitle()->AddTextFrameForOverriding(u"Sample Title");
chart->get_ChartTitle()->get_TextFrameForOverriding()->get_TextFrameFormat()->set_CenterText(NullableBool::True);
chart->get_ChartTitle()->set_Height(20);
chart->set_HasTitle(true);

// Delete default generated series and categories
chart->get_ChartData()->get_Series()->Clear();
chart->get_ChartData()->get_Categories()->Clear();
int s = chart->get_ChartData()->get_Series()->get_Count();
s = chart->get_ChartData()->get_Categories()->get_Count();

// Add series
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 1, ObjectExt::Box<System::String>(u"Series 1")), chart->get_Type());
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 2, ObjectExt::Box<System::String>(u"Series 2")), chart->get_Type());

// Add categories
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 1, 0, ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 2, 0, ObjectExt::Box<System::String>(u"Category 2")));
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 3, 0, ObjectExt::Box<System::String>(u"Category 3")));

// Take first chart series
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->idx_get(0);

// Populate series data
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 1, 1, ObjectExt::Box(20)));
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 2, 1, ObjectExt::Box(50)));
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 3, 1, ObjectExt::Box(30)));

// Setting fill color for series
series->get_Format()->get_Fill()->set_FillType(FillType::Solid);
series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue());

// Take second chart series
series = chart->get_ChartData()->get_Series()->idx_get(1);

// Populate series data
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 1, 2, ObjectExt::Box(30)));
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 2, 2, ObjectExt::Box(10)));
series->get_DataPoints()->AddDataPointForBarSeries(fact->GetCell(defaultWorksheetIndex, 3, 2, ObjectExt::Box(60)));

// Setting fill color for series
series->get_Format()->get_Fill()->set_FillType(FillType::Solid);
series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Orange());

// First label will be show Category name
SharedPtr<IDataLabel> lbl = series->get_DataPoints()->idx_get(0)->get_Label();
lbl->get_DataLabelFormat()->set_ShowCategoryName(true);

lbl = series->get_DataPoints()->idx_get(1)->get_Label();
lbl->get_DataLabelFormat()->set_ShowSeriesName(true);

// Show value for third label
lbl = series->get_DataPoints()->idx_get(2)->get_Label();
lbl->get_DataLabelFormat()->set_ShowValue(true);
lbl->get_DataLabelFormat()->set_ShowSeriesName(true);
lbl->get_DataLabelFormat()->set_Separator(u"/");

// Save PPT file
pres->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Ppt);  

    
 
  • เกี่ยวกับ Aspose.Slides สำหรับ C++ API

    สร้างแผนภูมิเอกสาร PPT ทันทีโดยไปที่ .ของเรา

    เว็บไซต์สาธิตสด

    . การสาธิตสดมีประโยชน์ดังต่อไปนี้

    Online PPT Chart Creation Live Demos

    Generate PPT documents charts right now by visiting our Live Demos website . The live demo has the following benefits

      No need to download Aspose API.
      No need to write any code.
      Just upload your PPT files.
      Chart will be created instantly.

    PPT PPT รูปแบบไฟล์คืออะไร

    A file with PPT extension represents PowerPoint file that consists of a collection of slides for displaying as SlideShow. It specifies the Binary File Format used by Microsoft PowerPoint 97-2003. A PPT file can contain several different types of information such as text, bulleted points, images, multimedia and other embedded OLE objects. Microsoft came up with newer file format for PowerPoint, known as PPTX, from 2007 onwards that is based on Office OpenXML and is different from this binary file format. Several other application programs such as OpenOffice Impress and Apple Keynote can also create PPT files.

    อ่านเพิ่มเติม

    รูปแบบแผนภูมิอื่นๆ ที่รองรับ

    การใช้ C ++ เราสามารถจัดการกับรูปแบบต่างๆได้อย่างง่ายดายรวมถึง

    PPTX (เปิดรูปแบบการนำเสนอ XML)