Word 2007: adxContextMenu keeps updating normal.dot or my document's template - asks do you want to save xxx.dot.

Add-in Express™ Support Service
That's what is more important than anything else

Word 2007: adxContextMenu keeps updating normal.dot or my document's template - asks do you want to save xxx.dot.
 
Sergei Z


Guest


I am using adxContextMenu to edit a specific MergeField type in word (Add-in).
I am using some events to change Visible and/or Endable property of my AdxCommandBarButton depending on where I am in the Word doc (SelectionChanged is one of them).

Everything works fine but when I close my document I am asked every time:

Do you want to save changes to "<myDocument'stemplate>.dot"?

This happens even if I did not changed anything in my .doc document.
I recon that changing AdxCommandBarButton.Enabled/Visible is recorded into my own/notmal.dot template (Visible property change happens on every mouse move etc...).
Note:
AdxContextMenu: Temporary==True; UseForRibbon == True;
AdxCommandBarButton: Temporary == True

[/B]Questions:[B]

1.How do I swith off this question (above) while keeping my nice Context-sensitivity of my menu options?

2.If this is not possible - can someone think of a workaround?
For example - may be it would be possible to create and use a temporary myTempNNNN.dot template for each .doc file I create and save changes to this template automatically before closing my document? A short code sample of how to achive that would be appreciated!

Thanks
Sergei.
Posted 26 Aug, 2011 05:53:09 Top
Eugene Astafiev


Guest


Hi Sergei,

Please take a look at the http://www.add-in-express.com/docs/net-commandbar-components.php section of the online documentation. Does it help?
Posted 26 Aug, 2011 06:09:45 Top
Sergei Z


Guest


No it does not really -
Nowhere it tells you how to avoid updating Normal.dot.

What I seem to get is that when I am adding my own menu item to an Office 2000-2007 context menu (adxCommandMenu.CommandBarName == "Fields" in my case) I get document's template updated. I know the topic you reffered me to says that MS uses Normal.dot (or my custom template .do file)to save my menu options.
The question I am asking is:
1)Why does it modify Normal.dot on each run of Word (and my Add-In). One would hope that if user saves normal.dot once he/she will not be asked again to do this?
Rephrasing:
1)Say my context menu AdxContextMenu command (ADXCommandBarButton) is "My Edit MergeField" and pop-upds a dialog with my advanced editor.

2)Then when I run my add-in very first time it would update normal.dot and Word will ask me if I want to save changes to normal.dot. This is cool with me so I unswer yes.

3)Now when I run Word 2nd time, I'd expect normal.dot to already have "My Edit MergeField" command saved in it. If this is true then I am not expecting "Do you want to save normal.dot?" question asked again ? Point is I did not change any properties of my adxContextMenu or my commandBarButton, so why am I getting this question again? Am I missing something? Or is this anavoidable?
Am I asking for too much?

4)Can't find any info on AdxContextMenu.Temporary property - I mean what is differnet when I have it False as opposed to True?
5)Also no info anywhere ADXCommandBarButton.Temporary? Again waht is the differenc in behaiviour when it is True as opposed to False?

Thanks
Sergei.
Posted 06 Sep, 2011 10:12:29 Top
Eugene Astafiev


Guest


Hi Sergei,

The http://www.add-in-express.com/docs/net-commandbar-components.php documentation states:

To speed up add-in loading when connecting to an existing command bar, set the Temporary property to False. To make the host application remove the command bar when the host application quits, set the Temporary property to True. However, this is the general rule only. If your add-in supports Outlook or Word, see How command bars and their controls are created and removed. You need to unregister the add-in before changing the value of this property.
...
In Word add-ins, we strongly advise making both command bars and controls non-temporary. Word removes temporary command bars. However, it doesn't remove temporary command bar controls, at least some of them; it just hides them. When the add-in starts for the second time, Add-in Express finds such controls and connects to them. Accordingly, because Add-in Express doesn't change the visibility of existing controls, the controls are missing in the UI.


You can read more about the Temporary property in the Command bar UI components section of the online documentation and in the Developers guide (see for the adxnet.pdf file in the Add-in Express installation folder).

In general, if you set the Temporary property to true your controls will be removed each time you close the host application. That is why you get such strange messages.
Posted 06 Sep, 2011 10:27:31 Top