Content Control XMLMapping RRS feed

  • Question

  • I am working on word2010 add-in (c#)

    In one of ribbon control button click event, I am adding footer content (which I have saved as building block). After inserting building block (building block have content controls) when I try to set XML mapping (as contentControl.XMLMapping.SetMapping(parameters)) to one of document properties, for first time (first call) I get pop up dialog box as saying

    Run-time error ‘6197’:

    The object model command is not available while in the current event.

    And it has buttons (continue, End, Debug, Help). Continue and Debug buttons are disabled. When I click on End, dialog box closes and everything works fine.

    I get dialog only for first-time after that its works fine.

    Monday, July 4, 2011 10:55 AM


  • Hi Manoj

    How about if you build a Timer into the button event that calls the code to create the mapping AFTER that event has finished processing? Does that work?

    If it does, create a class-level Boolean variable and set it to false. In the Ribbon click event check that value and, if it's false, use the Timer and set the value to True. After that you shouldn't need the Time any more?

    Cindy Meister, VSTO/Word MVP
    Thursday, July 7, 2011 1:16 PM