Gunakake pamriksa prabédan Swift file, mbandhingake rong dokumen lan deleng prabédan ing antarane dokumen kasebut kanthi jelas ing output. Sampeyan ora perlu maneh mbandhingake dokumen kanthi manual. Elinga uga yen asil perbandingan bisa diekspor menyang DOCX, PDF, DOC lan liya-liyane.
Solusi Swift kita dirancang kanggo menehi asil sing paling apik nalika nggunakake algoritma perbandingan sing rumit. Dadi, sampeyan ora perlu maneh kanthi manual nggoleki beda ing dokumen - bebas nggunakake API kita kanggo mbedakake rong file.
Mesin perbandingan kita nggoleki bedane ing tingkat karakter utawa kabeh tembung. Lan yen mung siji karakter diganti, kabeh tembung bakal disorot minangka diganti. Kabeh owah-owahan sing ditemokake bisa dideleng kanthi jelas ing output lan diekspor ing format sing trep.
Jinis perbandingan sing paling populer yaiku mbandhingake PDF file lan Word. Mula, kita bakal sinau alat diff Swift lan fungsi perbandingan nggunakake conto kasebut.
Kadhangkala sampeyan kudu nggawe manawa PDF dokumen sampeyan durung diowahi lan mbandhingake karo versi asli. Utawa sampeyan wis ngerti yen PDF sampeyan pancene wis diganti, lan sampeyan kudu nggoleki ngendi lan carane. Banjur sampeyan bisa mbandhingake rong versi PDF file lan ndeleng bedane. Lan supaya ora nindakake kanthi manual, gunakake Swift diff checker API.
Kanthi solusi Swift, sampeyan bakal bisa ndeleng owah-owahan cilik sing bisa gampang kantun ing perbandingan manual.
Dokumen Word cukup gampang diganti, mula penting kanggo mbandhingake Word file kanggo mesthekake bagean utawa kabeh dokumen ora diganti.
Kanggo mbandhingake Word file, gunakake solusi Swift, kaya PDF. Sampeyan bisa nindakake iki ing conto ing ngisor iki.
Kanggo ndeleng kepiye cara mbandhingake dokumen Swift, muat rong file sing pengin dibandhingake lan pilih format file ekspor.
Sawise mbandhingake rampung, dokumen kanthi diff bakal diundhuh kanthi otomatis ing format sing sampeyan pilih.
Penting yen dokumen sing dibandhingake kudu ora ana revisi sadurunge mbandhingake, mula kita kudu nampa kabeh revisi sadurunge mbandhingake diwiwiti. Aja kuwatir, kita wis ngurus ing conto kita:
import AsposeWordsCloud
let config =
Configuration(clientId: "####-####-####-####-####", clientSecret: "##################");
let api = try WordsAPI(configuration: config);
let fileName1 = "Input1.docx";
let fileName2 = "Input2.docx";
let fileResult = "Output.docx";
// Upload dokumen menyang panyimpenan maya.
let firstDocumentContent = InputStream(url: URL(string: fileName1))!;
let uploadFirstFileRequest =
UploadFileRequest(fileContent: firstDocumentContent, path: fileName1);
_ = try api.uploadFile(request: uploadFirstFileRequest);
let secondDocumentContent = InputStream(url: URL(string: fileName2))!;
let uploadSecondFileRequest =
UploadFileRequest(fileContent: secondDocumentContent, path: fileName2);
_ = try api.uploadFile(request: uploadSecondFileRequest);
// Mbandhingake dokumen ing awan.
let compareDataOptions = CompareData()
.setAuthor(author: "author")
.setFileReference(fileReference: FileReference(remoteFilePath: fileName2));
let compareDocumentRequest =
CompareDocumentRequest(name: fileName1, compareData: compareDataOptions,
destFileName: fileResult);
_ = try api.compareDocument(request: compareDocumentRequest);
// Download dokumen asil saka panyimpenan maya.
let downloadFileRequest = DownloadFileRequest(path: fileResult);
let downloadFileResult = try api.downloadFile(request: downloadFileRequest);
try downloadFileResult?.first?.value.write(
to: currentDir!.appendingPathComponent(fileResult, isDirectory: false));
Sampeyan bisa nggunakake manajer paket Swift lan manajer dependensi Cocoapods kanggo nginstal Aspose.Words Cloud SDK for Swift. Informasi rinci babagan nginstal paket diwenehi ing bagean "Installation and Usage".
Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Swift saka GitHub lan nggunakake ing project.
Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Swift 4.2 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian liyane.