Kamar yadda kasuwanci da daidaikun mutane ke dogaro da takaddun dijital, buƙatar ingantaccen kayan aikin kwatancen daftarin aiki ya zama mahimmanci. Kwatankwacin takardu da hannu na iya zama mai wahala, cin lokaci, da kuskure. Alhamdu lillahi, tare da ikon C# .NET, za ku iya sarrafa kan aiwatar da kwatancen takaddun Kalma, sa shi sauri, mafi daidai, kuma mafi aminci. A cikin wannan shafin yanar gizon, za mu bincika yadda za ku iya yin amfani da .NET Cloud SDK don kwatanta takardun Kalma, da kuma yadda za ku iya yin amfani da fasalulluka don adana lokaci da inganta tsarin nazarin takardunku.
- API ɗin REST don Kwatanta Takardu
- Kwatanta Takardun Kalma a cikin C#
- Kwatanta Takardu Biyu ta amfani da Umarnin CURL
API ɗin REST don Kwatanta Takardu
Aspose.Words Cloud SDK don .NET kayan aiki ne mai ƙarfi wanda zai iya taimaka maka kwatanta takaddun Kalma da sauƙi. Tare da cikakkun tsarin fasalin sa, zaku iya kwatanta takardu biyu ko fiye, zaku iya gano canje-canje da bambance-bambance a tsakanin su, da samar da rahoton da ke nuna canje-canje. Ko kai mai haɓakawa ne, mai sarrafa ayyuka, ko edita, wannan SDK na iya taimaka maka daidaita tsarin kwatanta daftarin aiki da adana lokaci mai mahimmanci.
Yanzu, don amfani da SDK, da fatan za a bincika ‘Aspose.Words-Cloud’ a cikin manajan fakitin NuGet kuma danna maɓallin Ƙara Kunshin don ƙara bayanin SDK a cikin aikin NET.
Kwatanta Takardun Kalma a cikin C#
Da fatan za a gwada amfani da snippet na lamba mai zuwa don kwatanta takaddun Word akan layi.
// Don cikakkun misalai da fayilolin bayanai, da fatan za a je zuwa
https://github.com/aspose-words-cloud/aspose-words-cloud-dotnet
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "7f098199230fc5f2175d494d48f2077c";
string clientID = "ee170169-ca49-49a4-87b7-0e2ff815ea6e";
// ƙirƙiri abin daidaitawa ta amfani da ClinetID da bayanan Sirrin Abokin ciniki
var config = new Aspose.Words.Cloud.Sdk.Configuration { ClientId = clientID, ClientSecret = clientSecret };
// fara misali WordsApi
var wordsApi = new WordsApi(config);
string firstDocument = "input-sample-1.docx";
string secondDocument = "input-sample-2.docx";
string resultantFile = "Comparison.docx";
// karanta abun ciki na farkon daftarin aiki Kalma daga tuƙi na gida
var firstFile = System.IO.File.OpenRead(firstDocument);
// karanta farko daftarin aiki na Word daga gida drive
var secondFile = System.IO.File.OpenRead(secondDocument);
try
{
// loda shigar da takaddun Kalma zuwa ma'ajiyar gajimare
wordsApi.UploadFile(new UploadFileRequest(firstFile, firstDocument));
wordsApi.UploadFile(new UploadFileRequest(secondFile, secondDocument));
CompareData compareData = new CompareData();
// saka takardar da za a kwatanta da ita
compareData.ComparingWithDocument = secondDocument;
// bayanan marubuci
compareData.Author = "Nayer Shahbaz";
compareData.DateTime = DateTime.Now.Date;
// tsarin daftarin aiki
compareData.ResultDocumentFormat = "DOCX";
// saita zaɓuɓɓukan kwatancen daftarin aiki
CompareOptions options = new CompareOptions()
{
IgnoreCaseChanges = true,
IgnoreFormatting = true,
IgnoreHeadersAndFooters = true,
IgnoreFootnotes = true,
IgnoreComments = true,
IgnoreTextboxes = true,
IgnoreTables = true,
Target = CompareOptions.TargetEnum.Current,
AcceptAllRevisionsBeforeComparison = true
};
compareData.CompareOptions = options
// Ƙirƙiri misali na CreateDocument
CompareDocumentRequest compare = new CompareDocumentRequest();
compare.CompareData = compareData;
compare.Name = firstDocument;
// resultant sunan fayil
compare.DestFileName = resultantFile;
// fara aikin kwatanta daftarin aiki
wordsApi.CompareDocument(compare);
}
catch(Exception ex)
{
// duk wani Keɓanta duirng fayil loda zuwa Cloud ajiya
Console.Write(ex.StackTrace);
}
// create configuration object using ClientID and Client Secret details
var config = new Configuration { ClientId = clientID, ClientSecret = clientSecret };
// initialize WordsApi instance
var wordsApi = new WordsApi(config);
Ƙirƙiri misali na WordsApi ta amfani da takardun shaidar abokin ciniki.
// read the content of first Word document from local drive
var firstFile = System.IO.File.OpenRead(firstDocument);
wordsApi.UploadFile(new UploadFileRequest(firstFile, firstDocument));
Karanta abun ciki na shigar da daftarin aiki Word kuma loda zuwa ma’ajiyar girgije.
CompareData compareData = new CompareData();
compareData.ComparingWithDocument = secondDocument;
compareData.Author = "Nayyer Shahbaz";
compareData.DateTime = DateTime.Now.Date;
compareData.ResultDocumentFormat = "DOCX";
Ƙirƙiri misali na CompareData abu inda muka ƙididdige sunan daftarin aiki da za a kwatanta, cikakkun bayanan marubuci, kwanan wata da bayanin lokaci da sigar daftarin sakamako.
CompareOptions options = new CompareOptions()
{
IgnoreCaseChanges = true,
IgnoreFormatting = true,
IgnoreHeadersAndFooters = true,
IgnoreFootnotes = true,
IgnoreComments = true,
IgnoreTextboxes = true,
IgnoreTables = true,
Target = CompareOptions.TargetEnum.Current,
AcceptAllRevisionsBeforeComparison = true
};
compareData.CompareOptions = options;
Ƙirƙiri misalin CompareOptions inda muke ayyana zaɓuɓɓukan kwatance daban-daban.
CompareDocumentRequest compare = new CompareDocumentRequest();
compare.CompareData = compareData;
compare.Name = firstDocument;
compare.DestFileName = resultantFile;
Ƙayyade misalin CompareData, sunan tushen takaddar Word da sunan fayil ɗin fitarwa mai ɗauke da sakamakon kwatanta.
wordsApi.CompareDocument(compare);
Fara aikin kwatancen daftarin aiki kuma samar da fitarwa a cikin ma’ajiyar girgije.
Kwatanta Takardu Biyu ta amfani da Umarnin CURL
Mun tattauna cewa kwatanta takaddun Word na iya zama aiki mai wahala da ɗaukar lokaci, musamman lokacin da ake mu’amala da fayiloli da yawa ko tsararru mai rikitarwa. Abin farin ciki, Aspose.Words Cloud da umarnin cURL suna ba da mafita mai ƙarfi don kwatanta takaddun Kalma cikin sauri da sauƙi. Za mu iya kwatanta takardu biyu ko fiye, bin canje-canje, da samar da cikakken rahoto wanda ke nuna bambance-bambance tsakanin takaddun.
Yanzu, da fatan za a aiwatar da umarni mai zuwa don ƙirƙirar alamar samun damar JWT dangane da ID na Abokin ciniki da bayanan Sirrin Abokin ciniki.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=a41d01ef-dfd5-4e02-ad29-bd85fe41e3e4&client_secret=d87269aade6a46cdc295b711e26809af" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Da zarar an ƙirƙiri JWT Token, da fatan za a aiwatar da umarni mai zuwa don kwatanta takaddun Kalma guda biyu akan layi kuma, adana fayil ɗin sakamako a cikin ma’ajiyar girgije.
curl -v "https://api.aspose.cloud/v4.0/words/{sourceFirst}/compareDocument?destFileName={differenceFile}" \
-X PUT \
-H "accept: application/json" \
-H "Authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{\"ComparingWithDocument\":\"input-sample-2.docx\",\"Author\":\"Nayyer Shahbaz\",\"DateTime\":\"2023-04-23T06:02:29.481Z\",\"CompareOptions\":{\"IgnoreCaseChanges\":true,\"IgnoreTables\":true,\"IgnoreFields\":true,\"IgnoreFootnotes\":true,\"IgnoreComments\":true,\"IgnoreTextboxes\":true,\"IgnoreFormatting\":true,\"IgnoreHeadersAndFooters\":true,\"Target\":\"Current\",\"AcceptAllRevisionsBeforeComparison\":true},\"ResultDocumentFormat\":\"docx\"}"
Sauya
{sourceFirst}
tare da sunan shigar da daftarin aiki Kalma (a yanzu a cikin ma’ajiyar girgije),{accessToken}
tare da alamar samun damar JWT da aka samar a sama da `{differenceFile}’ tare da sunan sakamakon daftarin aiki na Kalma yana nuna bambancin kwatanta. .
Kammalawa
A ƙarshe, kwatanta takaddun Kalma na iya zama aiki mai ban tsoro, amma tare da taimakon Aspose.Words Cloud da umarnin cURL ko .NET Cloud SDK mai ƙarfi, kuna da mafita mai ƙarfi a wurin ku. Ko kun fi son yin aiki tare da C# .NET ko kun fi son yin amfani da kayan aikin layin umarni kamar cURL, Aspose.Words Cloud yana ba da zaɓuɓɓuka da yawa don kwatanta takardu biyu ko fiye, sauye-sauyen bin diddigin, da samar da cikakkun rahotanni. Tare da sassauƙan sassauƙansa da daidaitacce, yana da mahimmancin hanya ga duk wanda ke aiki da takaddun Word akai-akai. Don haka me zai hana a gwada shi kuma ku ga yadda zai taimaka muku daidaita tsarin kwatanta daftarin aiki.
Hanyoyin haɗi masu amfani
Labarai masu alaka
Muna ba da shawarar yin amfani da shafukan yanar gizo masu zuwa: