Are you a C++ developer looking to add to integrate XML to OTP conversion feature inside your C++ applications? You can do it in two simple steps. You can export XML to PPTX by using Aspose.PDF for C++ . Secondly, by using Aspose.Slides for C++ , you can convert PPTX to OTP. Both APIs come under Aspose.Total for C++ package.
C++ API to Export XML to OTP
- Open XML file using Document class reference
- Convert XML to PPTX by using Save method function
- Load PPTX document by using Presentation class reference
- Save the document to OTP format using
Save
member function and set
Otp
as SaveFormat
Get Started with C++ File Automation APIs
Install from command line as nuget install Aspose.Total.Cpp
or via Package Manager Console of Visual Studio with Install-Package Aspose.Total.Cpp
.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .
// load XML file with an instance of Document class
auto doc = MakeObject<Document>(u"template.xml");
// save XML as PPTX format
doc->Save(u"PptxOutput.pptx", SaveFormat::Pptx);
// instantiate a Presentation object that represents a PPTX file
SharedPtr<Presentation> prs = MakeObject<Presentation>(u"PptxOutput.pptx");
// save the presentation as Otp format
prs->Save(u"output.otp", Aspose::Slides::Export::SaveFormat::Otp);
Change Password of XML Document via C++
In the process of rendering XML to OTP, you can open a password protected XML and also change its password. In order to change the password of a XML file, you must know the owner password of that document. You can load password protected PDF document with Aspose.PDF for C++ by specifying its owner password and use ChangePasswords method to change the password.
// load an existing XML Document
auto doc = MakeObject<Document>(L"input.xml", L"owner");
// change password of XML Document
doc->ChangePasswords(L"owner", L"newuser", L"newuser");
// save the document
doc->Save(L"output.Doc");
Add Images From Web in OTP File via C++
After converting XML to OTP, you can also add images from web to your output document. Aspose.Slides for C++ supports operations with images in these popular formats: JPEG, PNG, BMP, GIF, and others. You can add one or several images on your computer onto a slide in a presentation. This sample code in C++ shows you how to add an image to a OTP file
// instantiate a Presentation object that represents a OTP file
auto pres = System::MakeObject<Presentation>("output.otp");
// get slide
auto slide = pres->get_Slides()->idx_get(0);
// initialize Web Client
auto webClient = System::MakeObject<WebClient>();
// get image data
auto imageData = webClient->DownloadData(System::MakeObject<Uri>(u"[REPLACE WITH URL]"));
// add image
auto image = pres->get_Images()->AddImage(imageData);
// add picture frame
slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 100.0f, image);
// save updated file
pres->Save(u"updated.otp", SaveFormat::Otp);
Explore XML Conversion Options with C++
What is XML File Format
XML stands for Extensible Markup Language that is similar to HTML but different in using tags for defining objects. The whole idea behind creation of XML file format was to store and transport data without being dependent on software or hardware tools. Its popularity is due to it being both human as well as machine readable. This enables it to create common data protocols in the form of objects to be stored and shared over network such as World Wide Web (WWW). The "X" in XML is for extensible which implies that the language can be extended to any number of symbols as per user requirements. It is for these features that many standard file formats make use of it such as Microsoft Open XML, LibreOffice OpenDocument, XHTML and SVG. However, one limitation of the XML format is its verbosity. XML files can be large and contain a lot of repetitive markup tags, which can make them difficult to read and process. Additionally, the use of markup tags can introduce errors or inconsistencies in the data if not carefully managed.
Read MoreWhat is OTP File Format
OpenDocument Standard Format (ODF) is an XML-based file format for representing electronic documents such as spreadsheets, charts, presentations and word processing documents. The format is standardized by the Organization for the Advancement of Structured Information Standards (OASIS) and was first adopted by ISO/IEC JTC1 SC34 in 2005. ODF is an open format, meaning that it is not restricted by any copyright or patent.ODF is based on the XML schema of the OpenOffice.org office suite and uses the Zip compression algorithm. It is designed to be platform-independent and to be able to support a wide range of applications. The OpenDocument Format specification defines three document types:* Text documents* Spreadsheets* PresentationsEach document type has a corresponding XML schema. The schemas are designed to be extended, allowing application-specific features to be added.ODF documents can be encrypted and signed using the XML Encryption and XML Signature standards. The OpenDocument Format is supported by a number of office applications, including Apache OpenOffice, LibreOffice, IBM Lotus Symphony and Microsoft Office.
Read More