Using Textboxes and other objects in MS Word

Hello, is there a way to insert value in a textbox object in word? I am developing an application and I would like to put value inside the textbox object in ms word document. This will be used as the letter head address located at the right upper corner, addresses would be dynamic. We are still in the process of evaluating the software. It will be highly appreciated if you could give me sample codes for this.

Thanks

There are actually a number of ways of doing it.

If are creating the templates for generated documents yourself, or are able to edit and modify them, then the best possible way is to put a merge field inside the textbox and MailMerge address with a simple call like this:

doc.MailMerge.Execute(new string[] {"Address"}, new string[] {addressData});

Here, "Address" is the name of the corresponding merge field and addressData is the string containing the actual address.

Other way is putting bookmark inside the textbox in the template, then moving to a bookmark and writing the necessary text using DocumentBuilder.

If you cannot edit the template for generated documents then please provide the document sample. I will compose the more complex example that will allow you to insert text inside the textbox. It will require finding the needed textbox inside the document and putting runs of text right inside it using Document node tree manipulation.

Best regards,