Free Support Forum - aspose.com

Insert Text in word file

We had purchased professional edition of Aspose.Word but failed to do the following requirement.

I need to insert a text inside the existing word document like below

Date:
Venue:

The Venue and Date are hard coded in the document but the supposed to generate from the program

Please help

Hi,

You need to insert merge fields in the places where you need your data inserted.

Date: <>
Venue: <>

Once you have the merge fields in place you can use MailMerge.Execute method to insert data from some data source such as DataTable, DataView or even simple array of strings.

Alternatively, you can use DocumentBuilderClass.MoveToMergeField method to move DocumentBuilder’s cursor to the desired location in the document and insert text using DocumentBuilder methods such as Write.

Please check API documentation, it should have enough information to do that.