Our powerful Ruby SDK allows you to find the difference between DOCX documents and save the results to a convenient format for viewing. To verify our product capabilities, compare DOCX files using this Ruby library and see the differences.
Our Ruby 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 DOCX format has not been changed, and if it has, you need to find out what the difference is. Just use our Ruby diff tool to compare two DOCX 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 DOCX 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 DOCX files using Ruby SDK works. To achieve this, load the DOCX 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:
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
file_name1= 'Input1.docx'
file_name2= 'Input2.docx'
file_result= 'Output.docx'
# Upload documents to cloud storage.
first_document_content = File.open(file_name1)
upload_first_file_request =
UploadFileRequest.new(file_content: first_document_content, path: file_name1)
@words_api.upload_file(upload_first_file_request)
second_document_content = File.open(file_name2)
upload_second_file_request =
UploadFileRequest.new(file_content: second_document_content, path: file_name2)
@words_api.upload_file(upload_second_file_request)
# Compare documents in cloud.
compare_data_options =
CompareData.new({:Author => 'author',
:FileReference => AsposeWordsCloud::FileReference.fromRemoteFilePath(file_name2)})
compare_document_request =
CompareDocumentRequest.new(
name: file_name1, compare_data: compare_data_options, dest_file_name: file_result)
@words_api.compare_document(compare_document_request)
# Download result document from cloud storage.
download_file_request = DownloadFileRequest.new(path: file_result)
download_file_result = @words_api.download_file(download_file_request)
File.open('compareResult.pdf', 'wb').write(download_file_result)
Install Aspose.Words Cloud SDK for Ruby using RubyGems hosting service. Run gem install aspose_words_cloud to install the package. As an alternative, you can manually clone Aspose.Words Cloud SDK for Ruby 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.
You can perform compare operation for other file formats: