Document Assembly for C++

C++ SDK as a wrapper for the GroupDocs.Assembly Cloud API. Create highly‑customized reports, contracts, invoices and more directly from your C++ applications.

  • GroupDocs.Assembly Cloud SDK for cURL
  • GroupDocs.Assembly Cloud SDK for .NET
  • GroupDocs.Assembly Cloud SDK for Java
  • GroupDocs.Assembly Cloud SDK for Python
  • GroupDocs.Assembly Cloud SDK for PHP
  • GroupDocs.Assembly Cloud SDK for Ruby
  • GroupDocs.Assembly Cloud SDK for Node.js
  • GroupDocs.Assembly Cloud SDK for Go
  • GroupDocs.Assembly Cloud SDK for Swift
Start Free Trial

GroupDocs.Assembly Cloud SDK for C++ provides a high‑level, cross‑platform wrapper around the Assembly Cloud REST API, allowing developers to generate richly formatted documents directly from their C++ applications. The solution is built around templates—documents that contain special placeholder fields and generation rules—combined with data sources (XML or JSON). By sending the template and data to the cloud, the service assembles the final output in the desired format (DOCX, PDF, HTML, etc.) and returns it instantly.

Why use Assembly Cloud?

  • Zero‑installation – all heavy lifting is performed in the cloud; your C++ code only needs to issue HTTP calls.
  • Broad format support – generate Word, Excel, PowerPoint, PDF, OpenDocument, graphics, and many other formats without additional libraries.
  • Advanced template syntax – embed images, charts, barcodes, conditional sections, loops, formulas, and even email bodies directly in the template.
  • Security – communication is protected with SSL/TLS and authenticated via personal access keys, ensuring that confidential data never leaves the secure cloud environment.

Typical workflow in C++

  1. Configure the SDK with your App SID and App Key.
  2. Upload the template (e.g., InvoiceTemplate.docx) to GroupDocs Cloud Storage using the UploadFile endpoint.
  3. Prepare assembly options, specifying the template path, the data source (invoice.json or invoice.xml), and the desired output format.
  4. Call the AssembleDocument API – the service merges the data with the template, evaluates all expressions, and returns the assembled document.
  5. Download the result directly from the API response or via the Storage API for further processing.

This approach enables the creation of complex, multi‑page reports, personalized letters (Mail Merge), invoices, contracts, and any document that combines static content with dynamic data. Because the SDK is lightweight and works on any OS that supports C++11 and cURL, you can integrate it into desktop applications, server‑side services, or containerized micro‑services with minimal effort.

Assembly Cloud REST API Features

Generate documents from templates using a single API call

Bind data sources (XML, JSON) with LINQ‑style expressions

Embed images, charts, and external documents into output

Create dynamic tables and lists from array data

Conditional content blocks (IF/ELSE) in templates

Apply formulas and sequential calculations during assembly

Generate barcodes (QR, Code128, etc.) inside documents

Secure data transfer via SSL/TLS and personal access keys

Create email bodies and attach generated documents on the fly

Generate a document in C++ via REST API

The example below demonstrates the typical workflow: configure the SDK, upload a template, set assembly options, and call the Assemble endpoint to receive the generated document.

Steps:

  1. Initialise the SDK with your App SID and App Key.
  2. Upload the Word template (Input1.docx) to GroupDocs Cloud Storage.
  3. Create a TemplateFileInfo pointing to the uploaded template.
  4. Set the desired output format (docx) and provide the data source (Input2.json).
  5. Call assembleDocument to generate the final document.
using namespace groupdocs::assembly;
using namespace groupdocs::assembly::cloud::api;

// 1. Configure SDK with your credentials
auto config = std::make_shared<Configuration>(L"####################", L"####################");
auto assemblyApi = std::make_shared<AssemblyApi>(config);

// 2. Upload template file
auto fileName = L"Input1.docx";
auto requestFileContent = std::shared_ptr<std::istream>(
    new std::ifstream(std::filesystem::path(fileName), std::istream::binary));
std::shared_ptr<UploadFileRequest> uploadDocumentRequest(
    new UploadFileRequest(requestFileContent, std::make_shared<std::wstring>(fileName)));
assemblyApi->uploadFile(uploadDocumentRequest);

// 3. Prepare assembly options
auto fileInfo = std::make_shared<TemplateFileInfo>();
fileInfo->setFilePath(fileName);

auto assembleOptions = std::make_shared<AssembleOptions>();
assembleOptions->setSaveFormat("docx");
assembleOptions->setReportData(std::filesystem::path(L"Input2.json"));   // data source
assembleOptions->setTemplateFileInfo(fileInfo);

// 4. Assemble document
auto request = std::make_shared<AssembleDocumentRequest>(assembleOptions);
assemblyApi->assembleDocument(request);

Support and Learning Resources

GroupDocs.Assembly Cloud also offers SDKs for other languages:

  English
5f5c5ef