Hello, I am a developer learning how to use your platform with Ruby to create inventory reports for our customers and am having trouble populating images into a table with the proper size. The images appear, and the methods return success on every attempt, but using the recommended syntax in our template IMAGE:PHOTO_URL:W=50
or IMAGE(50pt;50pt):LOGO_URL
we notice that it’s not taking effect on the photos. The image size is being disregarded and blown up to a width that is beyond even the document width itself.
Here is the code I’m using for the PostDocumentExecuteMailMerge method provided by your API to create my JSON object:
def build_json(images, user)
hash = {
"LOGO_URL" => user.profile_photo_url,
"Artist_Name" => user.name,
"ACCOUNT_WEBSITE" => user.website_url,
"Account_Name" => user.name,
"ReportData" => [ ]
}
images.each do |img|
table_data = {
:PWf_Title => img.master_image.name,
:PWf_Image_URL => img.master_image.thumbnail_url,
:PWf_Year => img.master_image.year,
:PWf_Collection => img.master_image.collections.name,
:PWf_Paper_Type => img.paper_type,
:PWf_Paper_Size => img.display_dimensions,
:PWf_Frame_Size => img.display_frame_dimensions,
:PWf_Framing => img.frame_type,
:PWf_Edition_Size => img.out_of_edition
}
hash["ReportData"] << table_data
end
execute_mail_merge(hash)
end
def execute_mail_merge hashed_json
filename = ASPOSE_TEMPLATE
data = hashed_json.to_json
request = PostDocumentExecuteMailMerge.new filename, data, nil, :dest_file_name => nil
@words_api.post_document_execute_mail_merge request
end
In my storage, I have a template that includes the table, and static content at the top. I attached it in this message as well. I suspect it has something to do with the way the table is formatted, however, I’m not familiar enough with word or mail-merging to know what the inception of this problem is.
Thank you for all your help!
Gifton