none
Creating a Group Content Control without making a selection first RRS feed

  • Question

  • Hi,

    So far I've only been able to add a GroupContentControl by first making a selection to define the range and then adding it to the selection range like this example:

    http://msdn.microsoft.com/en-us/library/bb386181.aspx

    ie

        Dim range1 As Word.Range = VstoDocument.Paragraphs(1).Range
        range1.Select()
        groupControl1 = VstoDocument.Controls.AddGroupContentControl("groupControl1")

    However creating selections to do it creates a messy look as you see each selection before the control is added, plus it moves the cursor from it's previous position.

    I've tried to define the range through the addGroupContentControl Method (range, string). However it still requires a range to be selected in my document otherwise it results in the following error:


    "This method or property is not available because the current selection is locked for editing"

    This seems to be suggested as a requirement on the following page according to the example given without explicitly ruling it out:

    http://msdn.microsoft.com/en-us/library/bb398670.aspx

    Is there a way of doing this without selecting a part of the document?


    Thursday, March 27, 2014 1:26 AM

Answers

  • Hi,

    >>Is there a way of doing this without selecting a part of the document?<<

    No, I'm afraid we cannot avoid selecting a range to add group content control manually or programmatically. It is by design.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 28, 2014 9:52 AM
    Moderator

All replies