Skip to main content

Posts

Showing posts with the label VSTO

Running NCover on a 64bit machine

At a customer we are not using the Visual Studio Code Coverage feature to measure the unit test code coverage. Instead we are using NCover . As we are migrating from CruiseControl.NET to TFS Build, we installed NCover on our fresh new build server. Running the build resulted not in an all green report but in the following error: “System.DllNotFoundException: Unable to load DLL 'NCover.Lib.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)”   On the NCover forums , we found a solution for our problem. We accidently installed the x86 version of NCover on our 64bit build server.. Although it might work in some cases, it is not a supported configuration. So we removed the x86 version and did a clean install of the x64 version of NCover. This version includes both the 64-bit and 32-bit installations.

Create random text in Word 2007

An almost unknown feature of Word 2007  is that you can insert lorem ipsum text into the document to create some random text.  Just type in =lorem() into your document, and hit the enter key… If you need more text, you can also use the following syntax:     =lorem(paragraphs,sentences) For instance, for 6 paragraphs of 20 sentences each, you would use:    =lorem(6,20)

TF237002: Cannot open the document because Microsoft Excel 2007 or later, or one of its components is not installed.

One of my colleagues got the following error each time he tried to export workitems to Excel from within the Team Explorer 2010 client: TF237002: Cannot open the document because Microsoft Excel 2007 or later, or one of its components is not installed. It took me some time to figure out what was wrong: During the installation of Office 2007 he disabled the Office .Net Programmability Support. To enable it you need to modify your installed version of Office and install this option. 1. In Add/Remove programs, locate your Office application and select it. 2. Click on the 'Change' button 3. Select 'Add or Remove features' and click 'next' 4. Select 'Choose advanced customization of applications' and click 'next' OR select something like 'Add .Net programmability support'. 5. In the tree view, expand 'Microsoft Office Excel' and make sure the .NET Programmability Support option is set to 'run from my comput...

VSTO Fun

It’s always fun when you get a challenging requirement. Today I had to implement a feature to create readonly word documents. First I was looking at using the Protect Document features to implement this functionality. But a colleague found that there is a simpler option available. You can mark a document as final. Doing this using  VSTO is nothing more then setting the Document.Final property to true. However, our journey wasn’t complete yet, because once you change this property to true a dialog box is shown to the user and I couldn’t get rid of it. So in the end, I changed my implementation to use OpenXML and solved it by adding a CustomPropertiesPart to the WordDocument.

VS 2010: Interop type cannot be embedded. Use the applicable interface instead.

For a recent project we had to use the Excel Interop Assembly. But after referencing the Interop Assembly in Visual Studio 2010, we get an error when we try to compile.  Setting the "Embed Interop Types" to FALSE  solves the problem but of course than we loose a nice new feature in Visual Studio 2010. So where does this error comes from? One of the limitations for 'Embed Interop Types' feature has been that classes cannot be used when embedding an assembly. This limitation has to do with servicing - it is safe to embed metadata but not anything that can potentially contain executable code (class types contain metadata AND code while interfaces only contain metadata). When you try to references a class type from an Interop Assembly for which the "Embed Interop Types" is set to TRUE compiler do issue a warning. In most cases this error is the result of code which tries to instantiate a COM object e.g. here piece of code starting up Excel: 1: Excel.Applica...

VSTO here I come

For one of my current clients, I’ll have to start looking at the  Microsoft Visual Studio Tools for the Microsoft Office System(VSTO). I used to work with macro’s and the COM API’s for Office before. It was not really my best experience , so I was not too eager to start using VSTO. How could I be more wrong? It’s amazing how good these tools are integrated in the Office system. I’m really starting to like it. Some invaluable resources that helped me a lot: the VSTO team blog . Microsoft Visual Studio Tools for the Office System Power Tools v1.0.0.0 Office development with Visual Studio Portal Expect to get a lot more posts about VSTO in the near future.