StepUp
StepUp

Reputation: 38199

How to insert data into "placeholders" of a Word document?

I've read this article and I am amazed by opportunities of VSTO. It is really cool. Now I want to create some user controls(WPF) and insert data to a Word document at the specific places like that: enter image description here

I will have three WPF TextBox'es corresponding to placeHolder_* and a button which will read data from TextBox'es and insert text into placeholders. How to do it?(Couldn't find any info about it)

Any help such as example, tutorials which will be greatly appreciated!:)

Upvotes: 0

Views: 1812

Answers (1)

Cindy Meister
Cindy Meister

Reputation: 25693

Word offers two basic data "targets" for the document surface: Bookmarks and Content Controls. Both can be used from within VSTO as native Word objects or as the extended VSTO objects. There are plenty of code examples on the Internet and in the VSTO documentation. A good starting point is: https://msdn.microsoft.com/en-us/library/bb608598.aspx

Whether to use the native objects or the extended VSTO objects depends on your requirements. If you don't need the extended functionality (especially if your project is an application-level add-in) then it's usually simpler to stick with the native object.

Upvotes: 1

Related Questions