Aspose.Words  for C++

C++ Word Document Processing API

Generate, edit, convert and render Microsoft Word documents in C++ application without requiring Microsoft Word.

  Download Free Trial

Aspose.Words for C++ is an advanced Word Document Processing API to perform a wide range of processing tasks. Words' API provides document formatting, manipulation, mail merge, watermarking and much more capabilities directly within your own C++ applications without requiring Microsoft Word.

Aspose.Words API supports most of the Microsoft Word formats, and can render the document pages to a number of image formats. Thus, you can work with documents in DOC, DOCX, PDF, RTF, DOT, DOTX, DOTM, DOCM, FlatOPC, ODT, OTT, HTML, MHTML, MOBI, TXT, XPS, PS, TIFF, JPEG, PNG, BMP, SVG, EMF, GIF, PCL, EPUB, XML, XAML and more. You can see the full list of supported formats.

Functionality of Aspose.Words for C++

Aspose.Words is a self-contained C++ library. You do not need to install additional applications to get your C++ code working. This C++ API relies on the Document Object Model (DOM) to access document nodes and elements.

Advanced C++ Word API Features

You can try some of the popular Aspose.Words features on the online application pages:

You can try all Aspose.Words online applications.

Also check out the documentation for the most popular features in Aspose.Words:

Please note that the list is not complete and you can find more features and descriptions in the documentation.

Programming with Document Object Model

API enables C++ applications to automate Microsoft Word file creation as well as open and modify files including formatting with an intuitive document object model that mimics Microsoft Word in terminology & features. C++ developers can dynamically create, modify, extract and replace all elements including sections, paragraphs, tables, bookmarks, fields, form fields, comments, images, styles and so on.

Convert a Document in C++

Convert a file from one supported format to another with just two lines of code. It is so simple!

Convert Word to PDF using C++, e.g. DOCX to PDF – C++

// Load the document from disk.
System::SharedPtr doc = System::MakeObject(inputDataDir + u"Rendering.doc");

System::String outputPath = outputDataDir + u"Doc2Pdf.SaveDoc2Pdf.pdf";
// Save the document in PDF format.

Join or Append Documents in C++

Aspose.Words for C++ supports joining & appending multiple files into one. This process is very simple as well as configurable, providing the means to control how the files are joined. C++ Word processing library also allows resetting the page numbering after joining the documents.

Merge two files – C++

// Load source and destination files.
auto dstDoc = System::MakeObject<Document>(dir + u"destination.doc");
auto srcDoc = System::MakeObject<Document>(dir + u"source.doc");

// Set the appended file to start on a new page.

// Append the source file using the original styles found in the source file.
dstDoc->AppendDocument(srcDoc, ImportFormatMode::KeepSourceFormatting); 

// Save the result.
dstDoc->Save(dir + u"output.doc);

Use Document Protection in C++

Aspose.Words for C++ offers the facility to protect & un-protect documents with single line of code. You may set the protection in a way that the user can make only limited changes, such as adding annotations, making revisions or completing a form.

Protect and unprotect files – C++

// Load a document to be processed.
auto wrdoc = System::MakeObject<Document>(dir + u"template.doc");

// Protect the file.
wrdoc->Protect(ProtectionType::AllowOnlyFormFields, u"password");

// Unprotect the file.

Support and Learning Resources