In this topic, we will learn how to create DOCX in C++. Word documents are created programmatically especially in C++ and used many applications to achieve automation like utility bill generation. You can create DOCX on the fly in C++ using simple API interface.
Steps to Create DOCX in C++
- Include Aspose.Words.Cpp using NuGet package Manager
- Add reference to Aspose::Words and Aspose::Words::Saving and System::Drawing namespaces
- Create instance of Document Class to add a blank Word document
- Create DocumentBuilder Class instance to process the Word Document
- Add text in document along with formatting
- Save the Word document with custom formatting in DOCX format using Save method
In the following example we have shown, how you can create word document in C++ by adding text and setting its formatting. You will also see, how you can hyperlink the text in your document as well.
Code to Create DOCX in C++
In previous example, we looked in to How to Add Rows to Table in DOCX using C++. This topic focuses on generating a Word Document from scratch using C++.