Our powerful C# SDK allows you to find the difference between TXT documents and save the results to a convenient format for viewing. To verify our product capabilities, compare TXT files using this C# library and see the differences.
Our .NET SDK is designed to give you the most accurate result, even though comparison is a complex function itself.
Sometimes you need to be sure that the document in the TXT format has not been changed, and if it has, you need to find out what the difference is. Just use our .NET diff tool to compare two TXT files and find differences in whole words or single characters. Moreover, if only one character in a word has changed, this word will be marked as changed entirely.
Now you no longer need to spend time manually comparing TXT documents, and you can quickly find even small changes and export such diffs to a document in a convenient format.
Check out how our solution to compare TXT files using .NET SDK works. To achieve this, load the TXT files you want to compare and select the export file format – it will be automatically loaded after comparing.
Note that you need to accept all revisions in compared documents before calling the comparison method, as shown in our example:
using Aspose.Words.Cloud.Sdk;
var config = new Configuration
{
ClientId = "####-####-####-####-####",
ClientSecret = "##################"
};
var wordsApi = new WordsApi(config);
var fileName1 = "Input1.txt";
var fileName2 = "Input2.txt";
var fileResult = "Output.txt";
// Upload documents to cloud storage.
using var firstDocumentContent = File.OpenRead(fileName1);
var uploadFirstFileRequest = new UploadFileRequest(firstDocumentContent, fileName1);
await wordsApi.UploadFile(uploadFirstFileRequest);
using var secondDocumentContent = File.OpenRead(fileName2);
var uploadSecondFileRequest = new UploadFileRequest(secondDocumentContent, fileName2);
await wordsApi.UploadFile(uploadSecondFileRequest);
// Compare documents in cloud.
var compareDataOptions = new CompareData()
{
Author = "author",
FileReference = new FileReference(fileName2)
};
var compareDocumentRequest =
new CompareDocumentRequest(fileName1, compareDataOptions, destFileName: fileResult);
await wordsApi.CompareDocument(compareDocumentRequest);
// Download result document from cloud storage.
var downloadFileRequest = new DownloadFileRequest(fileResult);
var downloadFileResult = await wordsApi.DownloadFile(downloadFileRequest);
using (var fileStream = File.Create(fileResult))
{
downloadFileResult.CopyTo(fileStream);
}
Install 'Aspose.Words Cloud SDK for .NET' using NuGet package manager. Just run nuget install Aspose.Words-Cloud to automatically install and reference the corresponding assembly in your project. As an alternative, you can manually clone Aspose.Words Cloud SDK for .NET source code from GitHub and use it in your project. Please follow these Instructions to quickly get the necessary security credentials and access our REST API.
Refer to the Repository Documentation to see more details.
You can perform compare operation for other file formats: