JavaScript SDK kita sing kuat ngidini sampeyan nemokake prabédan antarane DOC dokumen lan nyimpen asil menyang format sing trep kanggo dideleng. Kanggo verifikasi kemampuan produk, mbandhingake DOC file nggunakake perpustakaan JavaScript iki lan deleng bedane.
Kita Node SDK dirancang kanggo menehi asil sing paling akurat, sanajan perbandingan minangka fungsi sing kompleks.
Kadhangkala sampeyan kudu mesthekake yen dokumen ing DOC format durung diganti, lan yen wis, sampeyan kudu ngerteni apa bedane. Cukup gunakake alat diff Node kanggo mbandhingake rong DOC 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 DOC 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 DOC file nggunakake Node SDK. Kanggo entuk iki, muat DOC 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:
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const fileName1 = "Input1.doc";
const fileName2 = "Input2.doc";
const fileResult = "Output.doc";
// Upload dokumen menyang panyimpenan maya.
const firstDocumentContent = fs.createReadStream(fileName1);
const uploadFirstFileRequest = new model.UploadFileRequest({
fileContent: firstDocumentContent,
path: fileName1
});
wordsApi.uploadFile(uploadFirstFileRequest)
.then((uploadFirstFileRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of UploadFirstFileRequest: ", uploadFirstFileRequestResult);
const secondDocumentContent = fs.createReadStream(fileName2);
const uploadSecondFileRequest = new model.UploadFileRequest({
fileContent: secondDocumentContent,
path: fileName2
});
wordsApi.uploadFile(uploadSecondFileRequest)
.then((uploadSecondFileRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of UploadSecondFileRequest: ", uploadSecondFileRequestResult);
// Mbandhingake dokumen ing awan.
const compareDataOptions = new model.CompareData({
author: "author",
fileReference: model.FileReference.fromRemoteFilePath(fileName2)
})
const compareDocumentRequest = new model.CompareDocumentRequest({
name: fileName1,
compareData: compareDataOptions,
destFileName: fileResult
});
wordsApi.compareDocument(compareDocumentRequest)
.then((compareDocumentRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of CompareDocumentRequest: ", compareDocumentRequestResult);
// Download dokumen asil saka panyimpenan maya.
const downloadFileRequest = new model.DownloadFileRequest({
path: fileResult
});
wordsApi.downloadFile(downloadFileRequest)
.then((downloadFileRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of DownloadFileRequest: ", downloadFileRequestResult);
fs.writeFileSync(fileResult, downloadFileRequestResult.body);
});
});
});
});
Instal 'Aspose.Words Cloud SDK for Node.js' nggunakake manajer paket NPM. npm install asposewordscloud --save saka baris perintah kanggo nginstal SDK liwat manajer paket NPM. Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for Node.js saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian liyane.
Sampeyan bisa nindakake operasi mbandhingake kanggo format file liyane: