Our powerful C++ SDK allows you to find the difference between HTML documents and save the results to a convenient format for viewing. To verify our product capabilities, compare HTML files using this C++ library and see the differences.
Our C++ SDK is designed to give you the most accurate result, even though comparison is a complex function itself.
Sometimes you need to be sure that the document in the HTML format has not been changed, and if it has, you need to find out what the difference is. Just use our C++ diff tool to compare two HTML files and find differences in whole words or single characters. Moreover, if only one character in a word has changed, this word will be marked as changed entirely.
Now you no longer need to spend time manually comparing HTML documents, and you can quickly find even small changes and export such diffs to a document in a convenient format.
Check out how our solution to compare HTML files using C++ SDK works. To achieve this, load the HTML files you want to compare and select the export file format – it will be automatically loaded after comparing.
Note that you need to accept all revisions in compared documents before calling the comparison method, as shown in our example:
using namespace aspose::words::cloud;
auto config =
std::make_shared<ApiConfiguration>(L"####-####-####-####-####", L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
std::wstring fileName1 = L"Input1.html";
std::wstring fileName2 = L"Input2.html";
std::wstring fileResult = L"Output.html";
// Upload documents to cloud storage.
auto firstDocumentContent =
std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(fileName1), std::istream::binary));
std::shared_ptr<requests::UploadFileRequest> uploadFirstFileRequest(
new requests::UploadFileRequest(
firstDocumentContent, std::make_shared<std::wstring>(fileName1)
)
);
wordsApi->uploadFile(uploadFirstFileRequest);
auto secondDocumentContent =
std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(fileName2), std::istream::binary));
std::shared_ptr<requests::UploadFileRequest> uploadSecondFileRequest(
new requests::UploadFileRequest(
secondDocumentContent, std::make_shared<std::wstring>(fileName2)
)
);
wordsApi->uploadFile(uploadSecondFileRequest);
// Compare documents in cloud.
auto compareDataOptions = std::make_shared<aspose::words::cloud::models::CompareData>();
compareDataOptions->setAuthor(std::make_shared<std::wstring>(L"author"));
compareDataOptions->setFileReference(
std::make_shared<aspose::words::cloud::models::FileReference>(
std::make_shared<std::wstring>(fileName2));
std::shared_ptr<requests::CompareDocumentRequest> compareDocumentRequest(
new requests::CompareDocumentRequest(
std::make_shared<std::wstring>(fileName1),
compareDataOptions, std::make_shared<std::wstring>(fileResult)
)
);
wordsApi->compareDocument(compareDocumentRequest);
// Download result document from cloud storage.
std::shared_ptr<requests::DownloadFileRequest> downloadFileRequest(
new requests::DownloadFileRequest(
std::make_shared<std::wstring>(fileResult)
)
);
auto downloadFileResult = wordsApi->downloadFile(downloadFileRequest);
{
char buffer[1024];
std::ofstream fileWriter(fileResult, std::ofstream::binary);
const auto& fileData = *downloadFileResult->begin();
while(fileData.second->read(buffer, sizeof(buffer))) {
fileWriter.write(buffer, sizeof(buffer));
}
fileWriter.write(buffer, fileData.second->gcount());
fileWriter.close();
}
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.
Refer to the Repository Documentation to see the details.
You can perform compare operation for other file formats: