Featured Post

SQL Query in SharePoint

The "FullTextSqlQuery" object's constructor requires an object that has context but don't be fooled. This context will no...

Thursday, October 28, 2010

Office.Interop Tip of the week

I needed to get all content controls inside a word document and add an OnEnter and OnExit eventhandler however when you loop through the Controls in a document you are only allowed to access them as Host Controls and not Host Items so the event handlers are not accessible. Then I found out that a document contains a "ContentControlOnEnter" and "ContentControlOnExit" event handler!

Update 17 May 2010

Have just found out that you should never assign this event to a Microsoft.Office.Interop.Word.Document but rather a Microsoft.Office.Tools.Word.Document. I was using the first document and my events sometimes get removed. To get the latter document, you can use this method Microsoft.Office.Tools.Word.Document.GetVstoObject();

No comments:

Post a Comment