none
Proper preventing users from entering text in Building Block selector RRS feed

  • Question

  • Hi everyone,

    I am buiding some templates in Word 2010, using CustomXMLParts and Content Controls. Also I'm using some building blocks to select portions of text which are neatly stored in my .dotx-file.

    When a template is completely done it is the wish of the customer to prevent any changes to the text. So I'm assigning a group to the complete text (Select all text, add group, set group to prevent from deletion).

    However, I discovered I need to place a group around the text I put in the building blocks library. So before I save my text as a building block I put a group around it, and make sure nothing but exactly the group is saved.

    When using the building block selector, all seems to go well. However, when navigating using the arrow keys it is possible to add text. In design mode it looks like this: (the building block selector is named 'Scenario')

    Now, if a user succeeds in putting the cursor between )Groep) and )Scenario) then text can be added:

    Putting the building block chooser in a group, doesn't help either. Any thoughts how to solve this? It is not a very big issue, but a small discomfort and it surprises me it is possible.....

    Friday, August 30, 2013 2:55 PM

All replies

  • I'm not sure I understand all the various options that are used in your scenario, but...

    When the document is in DESIGN mode there's no way to prevent the user typing "in between", no matter what protection options you set on the controls, themselves. You'd need to lock the users out of Design mode.

    In addition, you need to make sure that you set the Group content control to not allow editing (it's not enough to not allow deletion, the only option you mention).

    To lock out the Design Mode you'd need a Ribbon XML in the document/template with a Command element like the following

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    	<commands>
    		<command idMso="DesignMode" enabled="false"/>
    	</commands>
    </customUI>

     

    Cindy Meister, VSTO/Word MVP, my blog

    Friday, August 30, 2013 5:07 PM
    Moderator
  • Cindy,

    Thanx for your swift reply. Apparently I didn't phrase my question clear enough. Retrying ... :)

    I know that users can fairly easy use the design mode to circumvent the 'security'. But most users won't go though the trouble of enabling the developer tab, let alone the design mode.

    By default, a group is designed to prevent editing. I cannot find an option to tell it to do anything else. The 'prevent deletion' is just another (simple) precaution.

    So, the question remains: when NOT in design mode, is it possible to prevent addition of text between the tags )Group) and )Scenario). This can be simple be done by carefully pressing the arrow-right key until you see the ribbon change and can enter text.

    Monday, September 2, 2013 12:55 PM
  • <<So, the question remains: when NOT in design mode, is it possible to prevent addition of text between the tags )Group) and )Scenario). This can be simple be done by carefully pressing the arrow-right key until you see the ribbon change and can enter text.>>

    Except, in my test, I could only put the text in there when in Design Mode, thus my remark...

    As to blocking editing: Sorry about the misunderstanding. You need to place all the controls in a Rich Text content control, then a Group around the Rich Text control, and not allow editing in the Rich Text control.

    When I do that, I can position the IP between the controls, but nothing I type will work.


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, September 2, 2013 3:17 PM
    Moderator
  • Cindy,

    I tried your solution, but no improvement.... I created a video to help getting the problem across.... I hope. Please have a look at

    https://www.wetransfer.com/downloads/a96bbd8277d5c5da37f20e9a6f9f0ec720130903064253/e3378dfb2bc1e77909484236313c653a20130903064253/c90397

    In the video I first show how the document is setup, by entering design mode ('Ontwerp' in Dutch). Then I close the design mode and select a text using a building block selector. The text that is input from the building block is neatly wrapped in a group ('groep' in Dutch) as you can see when I enable design mode again.  The text in the group cannot be edited: the statubar indicates editing is prohibited. This can also be seen through the ribbon: almost no buttons are enabled.

    From time 00:35 I start moving the cursor with the arrow keys. Eventually, while still in the building block selector, the buttons in the ribbon are enabled and it is possible to add text. When entering design mode again one can see where the added text is placed.

    Hope this (finally) helps:) Thanx again for your efforts.

    Tuesday, September 3, 2013 6:55 AM
  • The video isn't much help as I never see what the settings are for the content controls. However, as I mentioned in my last reply, from my tests a Rich Text content control is required between the content control and the Group control: so there are THREE layers, not two, like in your video.

    And then you have to lock editing on the Rich Text content control.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, September 5, 2013 2:03 PM
    Moderator
  • @Cindy,

    Sorry the video wasn't much help. Indeed I needed to supply more information. However, a quick test with the 3 layer setup didn't perform as it should. I will try again in a more thorough test in order to make sure all the checkboxes and protections are setup as desribed.

    Wednesday, September 11, 2013 9:32 AM