I’m trying to do a simple word merge and not having any luck at all. The code runs through and places the word merge doc in my storage location, but after passing the word merge fields, it never seems to populate the actual word merge fields.
Here’s my code:wordmerge.PNG (79.5 KB)
Fields.PNG (5.8 KB)
string BaseProductUri = @"https://api.aspose.cloud";
Aspose.Words.Cloud.Sdk.Configuration configuration = new Aspose.Words.Cloud.Sdk.Configuration {
ApiBaseUrl = BaseProductUri + "/v1.1", AppKey = "XXXXXX", AppSid = "XXXXX" };
WordsApi _asposewords = new WordsApi(configuration);
StorageApi _storage = new StorageApi("XXXXX", "XXXX");
string localName = "MailMerge.docx";
string remoteName = DateTime.Now.ToLongTimeString() + TestPostDocumentExecuteMailMerge.docx";
string BaseTestPath = "C:\\Users\\bdubose\\Documents\\aspose\\";
string datafolder = "C:\\Users\\";
string fullName = Path.Combine(BaseTestPath, remoteName);
string destFileName = Path.Combine(datafolder, remoteName);
string data = System.IO.File.ReadAllText(BaseTestPath + "CoverLetterFields.txt");
Stream _stream = new FileStream(BaseTestPath + localName, FileMode.Open);
PutCreateRequest req = new PutCreateRequest();
req.Path = fullName;
req.File = _stream;
req.VersionId = null;
req.Storage = "First Storage";
_storage.PutCreate(req);
_stream.Close();
var request = new PostDocumentExecuteMailMergeRequest(remoteName, data, BaseTestPath, null, null, null, false, null, null, null, destFileName);
DocumentResponse actual = _asposewords.PostDocumentExecuteMailMerge(request);
So this all runs with no error. Of course my AppID and SID are actually filled in and not “XXXX”. I also recognize that the “BaseTestPath” is the directory my file is being uploaded to within Aspose Storage. I’ve screenshot my Mail Merge Docx file and the Data File that I’m passing into the “PostDocumentExecuteMailMergeRequest” method.
I’ll add that my code looks a bit different than the code samples given in Aspose’s documentation, because a requirement of mine is that we code against the .Net Core 2.1 framework.
I’ve alsoVersions.PNG (53.4 KB)
attached a screenshot of my currently packages within the project. Might it be an issue with Aspose.Storage-Coud 18.3.0? It seems to upload the document with no problem.
Any help with this is greatly appreciated.