Need Custom code

I came across the “Free-code” offer in Aspose blog. Hope the below description will give a fair idea about my requirement.
Programming language: C#
Preferred Aspose Version: 6.0.1
I have a master document that contains placeholders. The placeholders need to be replaced by the value of Word variables from a supporting document. Here are the properties of Placeholders

  1. The placeholder will be a text enclosed between '<%' and '%>'.
    For Example, <% NAME %> in Master.doc
  2. The placeholder will be replaced with the content of the variable that has the same name as that of the placeholder. In the above example, the placeholder <%NAME%> will be replaced with the content of variable named NAME.
  3. The properties of the placeholder should be retained while replacing the content. For example, if the placeholder is in BOLD, the replaced content should also be in BOLD.
  4. The placeholders in header and footer also need to be replaced.

There is another placeholder called <%BODY%> which will be replaced by the content of the supporting document. The properties of the content (not the placeholder) need to be retained while replacing the BODY placeholder.
ATTACHMENTS

  1. Master.doc
    This document contains placeholders
  2. Support.doc
    Supporting document that contains variables NAME, DOB, LOCATION, SECURITY_CODE.
  3. Final.doc
    This is the desired output after replacing the placeholders. You can notice the font changes in the Final doc.

Hi

Thanks for your request. I created code for you. Here it is:

// Open master document
Document doc = new Document(@"Master.doc");
// Create hashtable with data
Hashtable table = new Hashtable();
table.Add("NAME", "TEST NAME");
table.Add("SECURITYCODE", "XJ327372");
table.Add("DOB", "10/10/1963");
table.Add("LOCATION", "Pittsburgh");
// Value of BODY placeholder is document that should be inserted
table.Add("BODY", new Document(@"Support.doc"));
// Replace placeholders with data
PlaceHolderProcessor p = new PlaceHolderProcessor();
p.ReplacePlaceholders(doc, table);
// Save output document
doc.Save(@"Test101\out.doc");

PlaceHolderProcessor class is attached.
Hope this helps.
Best regards.

Thanks Alexey, cool stuff…
regards
Prasanth