Java 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 Java iki lan deleng bedane.
Kita Java 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 Java 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 Java 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:
import com.aspose.words.cloud.*;
ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);
String fileName1 = "Input1.docx";
String fileName2 = "Input2.docx";
String fileResult = "Output.docx";
// Upload dokumen menyang panyimpenan maya.
byte[] firstDocumentContent = Files.readAllBytes(Paths.get(fileName1).toAbsolutePath());
UploadFileRequest uploadFirstFileRequest =
new UploadFileRequest(firstDocumentContent, fileName1, null);
wordsApi.uploadFile(uploadFirstFileRequest);
byte[] secondDocumentContent = Files.readAllBytes(Paths.get(fileName2).toAbsolutePath());
UploadFileRequest uploadSecondFileRequest =
new UploadFileRequest(secondDocumentContent, fileName2, null);
wordsApi.uploadFile(uploadSecondFileRequest);
// Mbandhingake dokumen ing awan.
CompareData compareDataOptions = new CompareData();
compareDataOptions.setAuthor("author");
compareDataOptions.setFileReference(new FileReference(fileName2));
CompareDocumentRequest compareDocumentRequest =
new CompareDocumentRequest(fileName1, compareDataOptions,
null, null, null, null, null, fileResult, null);
wordsApi.compareDocument(compareDocumentRequest);
// Download dokumen asil saka panyimpenan maya.
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(fileResult, null, null);
byte[] downloadFileResult = wordsApi.downloadFile(downloadFileRequest);
Files.write(Paths.get(fileResult), downloadFileResult.values().iterator().next());
Instal 'Aspose.Words Cloud SDK for Java' nggunakake alat otomatisasi mbangun Maven.
Tambah ketergantungan iki menyang POM proyek sampeyan:
Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Java 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.
Sampeyan bisa nindakake operasi mbandhingake kanggo format file liyane: