Open DOC in C++ SDK

Use REST API to open and read DOC files programmatically in C++

Easily open DOC documents with just a few lines of C++ code. Our C++ library will provide you with everything you need to access DOC document content programmatically.

View code snippet

Open a DOC file in C++

The task of reading DOC documents is the task of reading hierarchical data structures within the DOM model. This implies knowing the format of each individual DOC data element, including all of its possible child elements and attributes.

Our C++ library is a cloud-based solution that will allow you to open DOC files for reading and writing easily. This distributed approach gives you flexibility in software development using C++ language, as all resource-intensive DOC document processing will take place on Aspose servers. All you need is to get private keys to access Cloud API in C++ code.

Programmatically read DOC documents in C++

You can iterate over all elements of a DOC document or you can search for specific elements in a DOM tree. We provide a wide range of C++ functions both for working with the structure of the DOC file and with the data contained in the document nodes.

The following code example will help you quickly figure out how to load a DOC file using C++ and perform some actions on it.

Upload a document you want to access
Run code
using namespace aspose::words::cloud;

auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####", 
   L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
std::wstring fileName = L"Input.doc";

auto requestFileContent = std::shared_ptr<std::istream>(
   new std::ifstream(
      std::filesystem::path(getFileTextUtf16(fileName)), std::istream::binary));
std::shared_ptr<requests::UploadFileRequest> uploadDocumentRequest(
    new requests::UploadFileRequest(
        requestFileContent, std::make_shared<std::wstring>(fileName)
    )
);
wordsApi->uploadFile(uploadDocumentRequest);

auto requestParagraph = std::make_shared<aspose::words::cloud::models::ParagraphInsert>();
requestParagraph->setText(std::make_shared<std::wstring>(
   L"Reading and writing to the file in the cloud occurs automatically."));
std::shared_ptr<requests::InsertParagraphRequest> insertParagraphRequest(
    new requests::InsertParagraphRequest(
        std::make_shared<std::wstring>(fileName), requestParagraph
    )
);
wordsApi->insertParagraph(insertParagraphRequest);

std::shared_ptr<requests::DownloadFileRequest> downloadDocumentRequest(
    new requests::DownloadFileRequest(
        std::make_shared<std::wstring>(fileName)
    )
);
wordsApi->downloadFile(downloadDocumentRequest);
Run code
  
Copy C++ code to the clipboard

How to open DOC C++ REST API

  1. Install Aspose.Words Cloud for C++
  2. Add a library reference (import the library) to your C++ project
  3. Read a DOC file

Install C++ library to read DOC files

Clone Aspose.Words Cloud SDK for C++ source code from GitHub. You can find detailed information on building and configuring the SDK in the "How to use the SDK" section.

To quickly get the necessary security credentials and access our REST API, please follow these Instructions in the documentation.

System Requirements

Refer to the Repository Documentation to see the details.

Other supported file formats

You can open documents in other formats:

5%

Subscribe to Aspose Product Updates

Get monthly newsletters and offers directly delivered to your mailbox.

© Aspose Pty Ltd 2001-2025. All Rights Reserved.