C++ SDK kita sing kuat ngidini sampeyan nemokake prabédan antarane DOCX dokumen lan nyimpen asil menyang format sing trep kanggo dideleng. Kanggo verifikasi kemampuan produk, mbandhingake DOCX file nggunakake perpustakaan C++ iki lan deleng bedane.
Kita C++ SDK dirancang kanggo menehi asil sing paling akurat, sanajan perbandingan minangka fungsi sing kompleks.
Kadhangkala sampeyan kudu mesthekake yen dokumen ing DOCX format durung diganti, lan yen wis, sampeyan kudu ngerteni apa bedane. Cukup gunakake alat diff C++ kanggo mbandhingake rong DOCX file lan temokake bedane kabeh tembung utawa karakter tunggal. Kajaba iku, yen mung siji karakter ing tembung sing diganti, tembung iki bakal ditandhani minangka diganti kabeh.
Saiki sampeyan ora perlu maneh nglampahi wektu kanthi manual mbandhingake DOCX dokumen, lan sampeyan bisa kanthi cepet nemokake owah-owahan cilik lan ngekspor bedane kasebut menyang dokumen kanthi format sing trep.
Priksa kepiye solusi kanggo mbandhingake DOCX file nggunakake C++ SDK. Kanggo entuk iki, muat DOCX file sing pengin dibandhingake lan pilih format file ekspor - bakal dimuat kanthi otomatis sawise mbandhingake.
Elinga yen sampeyan kudu nampa kabeh revisi ing dokumen sing dibandhingake sadurunge nelpon metode perbandingan, kaya sing ditampilake ing conto kita:
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.docx";
std::wstring fileName2 = L"Input2.docx";
std::wstring fileResult = L"Output.docx";
// Upload dokumen menyang panyimpenan maya.
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);
// Mbandhingake dokumen ing awan.
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 dokumen asil saka panyimpenan maya.
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();
}
Klone Aspose.Words Cloud SDK for C++ kode sumber saka GitHub. Sampeyan bisa nemokake informasi rinci babagan mbangun lan ngonfigurasi SDK ing bagean "How to use the SDK".
Kanggo entuk kredensial keamanan sing dibutuhake lan ngakses REST API kanthi cepet, tindakake Instructions iki ing dokumentasi.
Deleng Repository Documentation kanggo ndeleng rincian.
Sampeyan bisa nindakake operasi mbandhingake kanggo format file liyane: