Freigeben über


June CTP Drop: Some changes to dynamically added controls

We made a couple of small changes to our dynamic controls support feature--this is the feature where at runtime you can add new managed controls or host item controls to the document--like a button or a NamedRange.

Two changes:

1) There is now a Controls.AddBookmark method that takes an existing Word.Bookmark object as a parameter. This is useful if you dynamically added a word bookmark in one session, save the document, close the document, then code in a second session wants to hook up again to that dynamically added bookmark.

2) We added an InlineShape and a Shape property to dynamically added controls in Word. Previously there was no easy way to get from a dynamically added button in word for example to the corresponding InlineShape or Shape in the Word object model. There is also a Controls.GetShapeForControl(control) and Controls.GetInlineShapeForControl(control) that you can pass a dynamically added windows forms control and get back the corresponding InlineShape or Shape. If a given control is inline, the Shape property and GetShapeForControl method will return null. If a given control is not inline, the InlineShape property and the GetInlineShapeForControl method will return null.