In this topic, we will see how to create table in DOCX using C++. Tables are commonly used inside word documents and you can insert table in DOCX using C++. You can insert Word table in C++ using simple API calls.
Steps to Add Table in DOCX using C++
- Install latest version of Aspose.Words.Cpp from NuGet
- Include reference to Aspose::Words namespace
- Create Document Class object to load DOCX for adding table
- Instantiate DocumentBuilder Class to manage the content inside DOCX
- Use DocumentBuilder to add rows, cells and image inside cell
- Save the DOCX with Table in C++ by using Save method
In the example below, you can create Word table using C++ with no dependence on Microsoft Word. You can format the content inside table cells and we have shown how to add image inside cell too.
Code to Add Table in DOCX using C++
Previously, we saw How to Add Image in DOCX using C++. However, in this topic we learnt how to insert table in DOCX using C++.