Bandhingake rong DOC nggunakake JavaScript

Pemeriksa beda JavaScript sing akurat banget kanggo mbandhingake DOC file lan nemokake bedane

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.

Ndeleng potongan kode

Bandhingake DOC ing JavaScript

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.

Coba mbandhingake DOC dokumen

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:

Unggah file sing dibandhingake
Kode roto
Unggah file kapindho kanggo mbandhingake
Pilih format target saka dhaptar
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);
            });
        });
    });
});
Kode roto
  
Nyalin kode JavaScript menyang clipboard

Cara mbandhingake rong file teks

  1. Pasang Aspose.Words Cloud for Node
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek JavaScript sampeyan
  3. Muat rong DOC dokumen kanggo mbandhingake
  4. Telpon metode compareDocument() kanggo mbandhingake DOC docs
  5. Download dokumen asil saka panyimpenan maya

JavaScript perpustakaan kanggo nggunakake mbandhingake

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.

Requirements Sistem

  • @types/request (version 2.48.3+)
  • lodash (version 4.17.15+)
  • lodash.template (version 4.5.0+)
  • request (version 2.88.0+)
  • request-debug (version 0.2.0+)

Deleng Repository Documentation kanggo ndeleng rincian liyane.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi mbandhingake kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.