none
Content controls deleted on Enter (VSTO 3.0 + VS2010 + Office - Word - 2007) RRS feed

  • Question

  • Hello,

     

    I found a strange behavior in Word 2007 today, and I would like a confirmation of this. There are 2 scenarios. I am interested in the second one.

     

    Scenario 1 reproduction steps:

    1. Activate the Developer Tab.

    2. Insert a Building Block Gallery in the document, BBG1.

    3. Add 1-2 ContentControls inside the BBG1.

    4. Click on the title of BBG1. This will select all the content of the Content Control BBG1.

    5. Press Enter. => Everything inside BBG1 will be deleted (sometimes, even the control BBG1).

     

    My problem is if you make BBG1 editable = false;

    So the steps in my case would be:

    1. Activate the Developer Tab.

    2. Insert a Building Block Gallery in the document, BBG1.

    3. Add 1-2 ContentControls inside the BBG1.

    4. Place the cursor inside BBG1, and in the developer tab, select Properties.

    5. Check the option "Content cannot be edited".

    6. Click on the title of BBG1. This will select all the content of the Content Control BBG1.

    7. Press Enter. => Everything is deleted, even BBG1.

     

    Is the second scenario a normal behavior?

     

    Best regards,

    Silviu.


    http://www.rosoftlab.net/
    Monday, June 13, 2011 9:44 AM

Answers

  • Hi Silviu

    I would consider your second scenario "normal", yes. The default setting in Word is "typing replaces selection". So if you SELECT the content control (click on the "title") then press Enter what you type (a new paragraph) will replace the selection (content control).

    If you don't want to let the user delete the content control, activate the checkbox "Content control cannot be deleted" in the Properties.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Lupu Silviu Friday, June 17, 2011 6:11 AM
    Thursday, June 16, 2011 11:53 AM
    Moderator

All replies

  • Hi Silviu

    I would consider your second scenario "normal", yes. The default setting in Word is "typing replaces selection". So if you SELECT the content control (click on the "title") then press Enter what you type (a new paragraph) will replace the selection (content control).

    If you don't want to let the user delete the content control, activate the checkbox "Content control cannot be deleted" in the Properties.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Lupu Silviu Friday, June 17, 2011 6:11 AM
    Thursday, June 16, 2011 11:53 AM
    Moderator
  • Hello Cindy,

     

    Thank you for the reply.

     

    Best regards,

    Silviu.


    http://www.rosoftlab.net/
    Friday, June 17, 2011 6:11 AM