In this tutorial, we will learn how to insert comment into DOCX using C++. Comments are useful for reviewing the Word document. They don’t change the document itself but are used by authors to discuss or comment about any section of Word Document.
Steps to Add a Comment in DOCX using C++
- Install Aspose.Words.Cpp NuGet package
- Include reference to Aspose::Words namespace
- Create an instance of Document Class to load DOCX for adding comments
- Instantiate Comment Class object to add comment in DOCX using C++
- Save the Word file with Comments in C++ by using Save method
In the following code, we have shown how easily you can include comments in DOC file using C++ with no dependence on Microsoft Word or Office Interop API. You can use SaveFormat to save the document in DOCX or DOC format.
Code to Add a Comment in DOCX using C++
In previous example, we saw How to Convert HTML to PDF using C++. In this topic, we have explained how to insert comments in DOCX using C++ using few lines of code.