Hello,
we have a routine that compiles a contract set of data (we usually call them tags) and then replace the respective tag name from a Word document. Note that the text on the Word template are not merge fields, just plain text.
Currently we are doing a replacement routine on the internal XML document file, and are trying to find a more effective and consistent way of doing this process.
I made a sample console app (no text is generated, just the output file is opened on completion) up to the point I was able to make do what we need, however I did not found how to "copy and paste" the found text blocks to do multiple replacements, as it is the case when the contract if for more than one customer. Example:
{CUSTOMERS}Name: “{CUSTOMER_NAME}”, with ID “{CUSTOMER_ID}”
{/CUSTOMERS}
(the line break is intentional as to put each customer in a separate line)
In my example, the data of 2 customers must be applied to the groups.
I would like to know how to, after finding a customer group, pick that text block and do a paste-and-replace on the document for the amount of customers given.
Also, in the example I use data "pages" because the clients have the ability to generate multiple contracts as one document, so a "page" contains the data for each contract (in my example I left as 3 pages to check if there's no erroneous replacement)
Thanks in advance.
Thanks for the response.
The use o merge fields seems to almost solve the contract generation, however we require that the customers from a contract to be on the same document. This is signaled by the "{CUSTOMERS}[...]{/CUSTOMERS}" sections on the template document. Based on your example, "Customer#1" and "Customer#2" should be on the same document copy.
With mail merge in mind I came across this page that suggest using ExecuteNestedGroup to achieve that. Now what I am not sure how to do is how we setup a "blank" data source (I think a sample line for each group would be enough) so our clients can make use of the expected fields while making the template document. For this example, I believe the hierarchy would be:
Thank you,
With your example I was able to setup a test template document.
For future reference:
One of the issues I had was that changing the text on the merge field actually doesn't change the name of field itself. You need to right click the field and use "Edit Field..." to really change it's name.
Now I have done it so it removes empty groups too, as it is possible to some contracts have a group and another one not have the corresponding data.
Attached is a working example.