It looks like your template related issue. I have tested the scenario using the following template without any issues. Please attach your template document to the post. It will help us to investigate and guide you exactly.
We are using Ruby SDK for AsposeWordsCloud::ExecuteMailMergeOnlineRequest and testing using Aspose Demo https://products.aspose.app/words/mailmerge to test. I could not get the template you sent to work with the JSON in that online demo.
Previously, I have tested the scenario using ExecuteMailMergeOnline API method of Aspose.Words Cloud SDK for .NET. However, it is working as expected using the Aspose.Words Cloud SDK for Ruby. Please check the sample code for your reference. TestExecuteTemplate_out.docx (13.8 KB)
require 'aspose_words_cloud'
class Document
include AsposeWordsCloud
# Get App key and App SID from https://dashboard.aspose.cloud/
APP_KEY = "xxxxxxxxxxxxxxxxxxxxxxx"
APP_SID = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
FILE_PATH = "C:/Temp/MailMergeSamples/"
def initialize
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = APP_SID
config.client_data['ClientSecret'] = APP_KEY
end
@words_api = WordsApi.new
end
# MailMerge
def execute_mailmerge_online
local_document_file = 'Template_MailMerge_Test.docx'
local_data_file = 'Template_MailMerge_TestData.json'
output_file = 'TestExecuteTemplate_out.docx'
request_data = File.read(FILE_PATH + local_data_file)
request_template = File.open(FILE_PATH + local_document_file)
request = ExecuteMailMergeOnlineRequest.new(template: request_template, data: request_data, with_regions: true)
result = @words_api.execute_mail_merge_online(request)
File.open(FILE_PATH + output_file, 'wb').write(result)
puts "MailMerge Completed......"
end
end
document = Document.new()
puts document.execute_mailmerge_online