Go SDK kita sing kuat ngidini sampeyan nemokake prabédan antarane TXT dokumen lan nyimpen asil menyang format sing trep kanggo dideleng. Kanggo verifikasi kemampuan produk, mbandhingake TXT file nggunakake perpustakaan Go iki lan deleng bedane.
Kita Go SDK dirancang kanggo menehi asil sing paling akurat, sanajan perbandingan minangka fungsi sing kompleks.
Kadhangkala sampeyan kudu mesthekake yen dokumen ing TXT format durung diganti, lan yen wis, sampeyan kudu ngerteni apa bedane. Cukup gunakake alat diff Go kanggo mbandhingake rong TXT 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 TXT 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 TXT file nggunakake Go SDK. Kanggo entuk iki, muat TXT 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 (
"os"
"github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)
config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)
fileName1:= "Input1.txt"
fileName2:= "Input2.txt"
fileResult:= "Output.txt"
// Upload dokumen menyang panyimpenan maya.
firstDocumentContent, _ := os.Open(fileName1)
uploadFirstFileRequestOptions := map[string]interface{}{}
uploadFirstFileRequest := &models.UploadFileRequest{
FileContent: firstDocumentContent,
Path: ToStringPointer(fileName1),
Optionals: uploadFirstFileRequestOptions,
}
_, _, _ = wordsApi.UploadFile(ctx, uploadFirstFileRequest)
secondDocumentContent, _ := os.Open(fileName2)
uploadSecondFileRequestOptions := map[string]interface{}{}
uploadSecondFileRequest := &models.UploadFileRequest{
FileContent: secondDocumentContent,
Path: ToStringPointer(fileName2),
Optionals: uploadSecondFileRequestOptions,
}
_, _, _ = wordsApi.UploadFile(ctx, uploadSecondFileRequest)
// Mbandhingake dokumen ing awan.
compareDataOptions := models.CompareData{
Author: ToStringPointer("author"),
FileReference: models.CreateRemoteFileReference(fileName2),
}
compareDocumentRequestOptions := map[string]interface{}{"destFileName": fileResult,}
compareDocumentRequest := &models.CompareDocumentRequest{
Name: ToStringPointer(fileName1),
CompareData: &compareDataOptions,
Optionals: compareDocumentRequestOptions,
}
_, _, _ = wordsApi.CompareDocument(ctx, compareDocumentRequest)
// Download dokumen asil saka panyimpenan maya.
downloadFileRequestOptions := map[string]interface{}{}
downloadFileRequest := &models.DownloadFileRequest{
Path: ToStringPointer(fileResult),
Optionals: downloadFileRequestOptions,
}
_, _ = wordsApi.DownloadFile(ctx, downloadFileRequest)
Run go get -v github.com/aspose-words-cloud/aspose-words-cloud-go/2007/api kanggo nginstal Aspose.Words Cloud SDK for Go. Sampeyan bisa entuk akeh informasi migunani babagan cara instalasi liyane saka bagean "How to use SDK".
Klone Aspose.Words Cloud SDK for Go saka GitHub lan gunakake ing proyek sampeyan. 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: