Technical question - command bar linked with document in Word 2003

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

Technical question - command bar linked with document in Word 2003
 
Borys Janiszewski




Posts: 1
Joined: 2010-02-12
My team has some serious problems trying to customize a toolbar for each document seperately. We use VisualStudio 2008 and VSTO 2005 for developing Word 2003 addin(application level).

We are developing document versioning and managment system that have to be integrated with word. We would like that each open document in Word have a toolbar that would be displaying document specific informations on that toolbar - current document version, version list etc.

We currently are unable to achieve desired behaviour. We tried to customize a single toolbar each time active document changes, but every time we change something on toolbar, the change propagates on all opened windows so it is no longer document-specific. We tried adding seperate toolbar for each document, but setting visible property to false, disables every toolbar on every opened window - so only one toolbar on currently opened document would be visible, on other windows every toolbar would be hidden - that is also the behavior that we dont want. We also tried setting CustomizationContext to active document, and it so far worked the best - the toolbar was visible only on document for within it was created and displayed document-specific informations. Unfortunely the toolbar was saved within document content, and since there is no appropriateave event which makes us sure that document is being closed/saved - we cannot remove toolbar on save(DocumentBeforeSave event is fired before actual save operation is made, but it is not guaranted that the save would occur - user still can cancel the operation, simmilar with Document.Close event, also there is no event fired after document was saved/closed so we cannot recustomize document). We dont want to our users to see our custom toolbars when they dont work with our addin, so again this scenarion also wont work.

In general we want that:

- each open document(window) has its own toolbar only visible on that window that displays informations linked with specific document
- each toolbar on every opened document has its own informations displayed on it, specific to document it belongs to
- if document is not within our system - no toolbar is displayed - word behave like without our addin
- toolbar is not saved within the document content
- we dont want mess with document base template - user have to have the ability to customize its document beside our addon

*********************************************************************

Now here is my question - is Add-in Express Suite able to provide us sufficient functionality to achieve our goal?
Posted 12 Feb, 2010 04:22:51 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi Borys,

You could customize your toolbar in the WindowActivate event but here is a problem: Word transfers the changes to other open documents. If Word window is maximized, you will not see that issue. But if you show two Word windows on the screen, you'll see what I mean. There's no way to overcome that behavior.

I'd suggest you to considere using a custom pane instead of the toolbar. In addition to solving the issue above as well as bypassing all normal.dot-related problems, you'll be able to use .NET controls instead of Office ones.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Feb, 2010 12:35:54 Top