Document doc = new
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField(@"MERGEFIELD MyFieldName \* MERGEFORMAT");
// Insert a simple Date field into the document.
builder.insertField(@"DATE \* MERGEFORMAT");
Thanks for you answer but it’s not quite what I need.
In fact, i need to attach a word blank document and a list of merge field who will be available in Word for this document.
Thanks for your request. You should attach a data source to your document to achieve this. Please see the following thread for more information:
Thanks a lot, i’ll try that !
This code is .Net like, i’ll try to mix it to Java
Ok thanks a lot, it’s working !
Thank you for sharing your code. Unfortunately, there is no way to embed data source into the document. MS Word does not allow this. Also I did not manage to find a way to reference data source from web. So the only way to achieve this is using two files – template and data source.
Thanks for your request. I am not sure this is possible in MS Word. You can try setting this option, but I am not sure it will help:
Thanks but it doesn’t work.
Thank you for additional information. I suspected this. Unfortunately, I do not have anything else to suggest. I suppose this is simply impossible in MS Word.