Microsoft Word Mail Merge Template corrupts after uploading with Aspose.Storage REST API in Salesforce

Hello there,

I am trying to start off with the Aspose Cloud and am running into a problem. I uploaded the file onto the storage. While doing a GET on the fieldnames, the response seems to be ‘Unknown File Format’ Error.

For the template, I tried both {{FieldName}} and «Fieldname» (Insert MergeField)

Both the cases it returns me the error: Unknown File Format.

Here’s my API call:

https://api.aspose.com/v1.1/words/ >/mailMergeFieldNames?folder=<>&appSID=<>&signature=<>

Thank you :slight_smile:

Update: Is the 400 Bad Request due to invalid signature? I am using the Sample code provided for Aspose for Salesforce. One more thing. The pdf part to fetch the fields is working and not the words. Any idea?

Hi there,

Thanks for your inquiry.

Sithlord:

I am trying to start off with the Aspose Cloud and am running into a problem. I uploaded the file onto the storage. While doing a GET on the fieldnames, the response seems to be ‘Unknown File Format’ Error.

I have tested the scenario and have not found the shared issue. Please try again to get the mail merge field names in a document. If you still face problem, please also send your App SID and Key to me by following the instructions at https://company.aspose.com/contact to analyze this issue.
Sithlord:

For the template, I tried both {{FieldName}}

Unfortunately, Aspose.Words does not support the requested feature (
get the names of mustache fields) at the moment. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

Hey Tahir,

I am still running into the issue with Bad request. I have PMed you about the information you asked for.

Sunil

Hello Tahir,

This issue is actually because of corrupted document that was uploaded to the Cloud storage. I was uploading to the cloud storage with PUT method from salesforce. The pdf seems to retain its identify but docx/doc file seems to get corrupted somehow.

Is there any example for salesforce docx/doc upload from salesforce to Aspose?


Hi Sunil,

Thanks for sharing the detail via email.

I have tested the scenario using your appSID and appKey for document SalesOrderTest.docx inside folder ‘00DF00000006R9tMAE’ and have not found any issue. Please check the scenario with SalesOrderTest.docx.

I have not found the document (f5dd4ce5-db14-2efd-2230-fd25c4a7b960.docx) which you are using in your URI.

Sithlord:

Is there any example for salesforce docx/doc upload from salesforce to Aspose?

Please read the following documentation link to send request and receive response (Salesforce REST).
https://docs.aspose.cloud/display/wordscloud/Aspose.Words+Cloud+for+SalesForce

Please also use the Sign method for Salesforce from here:
https://docs.aspose.cloud/display/wordscloud/Aspose.Words+Cloud+for+SalesForce#Aspose.WordsCloudforSalesForce-CodeSample

Hello Tahir,

When I manually upload a file to aspose cloud, I don’t see an issue with the fetch of mailmergefieldnames. The issue mentioned in the thread comes up when I upload the file to the aspose cloud.

The issue was because of the corrupted doc(x) file in the aspose cloud. From salesforce I am doing a multipart/form-data which is getting corrupted.

For the multipart/formadata upload, I am referring to the snippet provided here:
Nerd @ Work: [Salesforce / Apex] POST Mutipart/form-data with HttpRequest

BTW: the filename for salesordertest.docx is changed to that big file name before the upload to avoid any overwrite. I may have cleared my storage - that may be the case

thank you

Hi Sunil,


Thanks for your inquiry. We are checking with this scenario and will get back to you soon.

thanks Tahir. I have attached the corrupted file to the thread.

Hello Tahir,

There was an issue with the http request I was sending and the code specified had to be tweaked to allow for docx uploads. This works for me now and the thread can be closed

Thanks for your help!

Sunil

Hi Sunil,


Thanks for your feedback. It is nice to hear from you that your problem has been solved. It would be great if you please share the code which you are using to upload salesforce docx/doc from salesforce to Aspose for reference of other customers.

Hi Sunil,


Thanks for being patient. We have good news for you i.e. SAASWORDS-139 has now been resolved. You may now please re-test your scenario with Aspose.Words for Cloud. Hope, this helps.

Best regards,

@Sithlord

Please note now Aspose.Words Cloud API Version V4.0 introduced its native Storage API methods, so there is no need to use Aspose.Storage Cloud API anymore.

Furthermore, we have simplified Mail Merge methods as well. We have combined Mail Merge and Mustache template APIs. Now the same API method will be used for both types of templates.

// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

//upload file to cloud storage
curl -X PUT "https://api.aspose.cloud/v4.0/words/storage/file/Temp%5CTest.pdf" 
-H "accept: application/json" 
-H "Authorization: Bearer [Access_Token]" 
-H "Content-Type: multipart/form-data" 
-H "x-aspose-client: Containerize.Swagger" 
-F "fileContent=@C:/Temp/02_pages.pdf"