Create PPTX File in C++
Native and high performance PPTX file creation programmatically without Micorsoft Office using C++ library.
Create PPTX File Using C++
How to create PPTX file? With Aspose.Cells for C++ library, you can easily Create PPTX file programmatically with a few lines of code. Aspose.Cells for C++ is capable of building cross-platform applications with the ability to generate, modify, convert, render and print all Excel files. C++ Excel API not only convert between spreadsheet formats, it can also render Excel files as images, PDF, HTML, ODS, CSV, SVG, JSON, WORD, PPT and more, thus making it a perfect choice to exchange documents in industry-standard formats. You can download its latest version directly, just open NuGet package manager, search for Aspose.Cells.Cpp and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Cells.Cpp
How to Create PPTX in C++
It is easy for the developers to create, load, modify and convert PPTX files within running reporting applications for data processing in just few lines of code.
- Create an object of the IWorkbook class.
- Get the first sheet into an IWorksheet object.
- Use IWorksheet->GetICells() method to get the cells of the worksheet into an ICells object.
- Use ICells->GetObjectByIndex() method to access the desired cell of the worksheet into an ICell object.
- Use ICell->PutValue() method to input value into the cell.
- Save the workbook as .pptx file using Save() method.
Sample code shows how to create PPTX file in C++.
// Create an object of the IWorkbook class.
intrusive_ptr<IWorkbook> wkb = Factory::CreateIWorkbook();
// Get the first sheet into an IWorksheet object.
intrusive_ptr<IWorksheetCollection> wsc = wkb->GetIWorksheets();
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0);
// Use IWorksheet->GetICells() method to get the cells of the worksheet into an ICells object.
intrusive_ptr<ICells> cells = ws->GetICells();
// Use ICells->GetObjectByIndex() method to access the desired cell of the worksheet into an ICell object.
intrusive_ptr<ICell> cell00 = cells->GetObjectByIndex(0, 0);
intrusive_ptr<ICell> cell01 = cells->GetObjectByIndex(0, 1);
intrusive_ptr<ICell> cell10 = cells->GetObjectByIndex(1, 0);
intrusive_ptr<ICell> cell11 = cells->GetObjectByIndex(1, 1);
// Use ICell->PutValue() method to input value into the cell.
cell00->PutValue(new String("ColumnA"));
cell01->PutValue(new String("ColumnB"));
cell10->PutValue(new String("ValueA"));
cell11->PutValue(new String("ValueB"));
// Save workbook to resultFile folder
wkb->Save(new String("created_one.pptx"));
C++ library to create PPTX file
There are three options to install “Aspose.Cells for C++” onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:
- Install a NuGet Package . See Documentation
- Install the library using Include and lib Folders. See Documentation
- Install Aspose.Cells for C++ in Linux. See Documentation
System Requirements
Before running the C++ conversion sample source code, make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
- Add reference to the Aspose.Cells for C++ DLL in your project.
PPTX What is PPTX File Format?
Files with PPTX extension are presentation files created with popular Microsoft PowerPoint application. Unlike the previous version of presentation file format PPT which was binary, the PPTX format is based on the Microsoft PowerPoint open XML presentation file format. A presentation file is a collection of slides where each slide can comprise of text, images, formatting, animations, and other media. These slides are presented to audience in the form of slideshows with custom presentation settings.
Read MoreOther Supported Sheets Generation
You can also create other Microsoft Excel files including few listed below.