Thursday, 11 April 2013

Work Items loosing formatting when edited in Microsoft Excel

Recently, we upgraded to Team Foundation Server 2012 for our project. The upgrade was generally a smooth affair and apart from a few niggles went out trouble free. Here is one of the niggles we faced, so I thought to blog about it here.

A sizeable number of people in our team use Microsoft Excel to edit work item especially where there is a lot of text to write such as Test Cases. It only takes a couple of clicks to open the work item in Microsoft Excel and user can use the rich editing functionality provided by Office.

However, after we moved to TFS 2012, editing work item description in Excel would show the following warning and the description would lose all its formatting.

As, it turns out the change in behaviour is caused because the upgrade process had changed the type of our Description field from PlainText to HTML. 

However, Team Foundation Server doesn't allow editing the actual HTML of the fields. This means that the text typed in Excel would be published without any of its tags and that is the reason that it lost its formatting. Here is the reason why Microsoft wouldn't allow HTML editing.

For us, it was important to keep the ability of editing work item in Excel, so the solution was to change the type of System.Description field to PlainText. This can be done by using the Witadmin utility. Following is the command that I executed. 

witadmin changefield /collection:<ProjectCollectionUrl> /n:System.Description /type:PlainText
Please note that the change will happen at Project Collection level and you will need to have appropriate permissions on all team projects within the collection. 

No comments: