I have reached now another step on the new authoring tool for Tech Head Brothers portal by having some authors installing this new version and starting beta testing it. Has you can see, with the following twit, it seems that the tool is on the good way:
From Rédo (french blog)
Just try the new beta tool of publishing for http://www.techheadbrothers... .... that's the Wouawwww effect !!! ... sorry, it's NDA ;p about 23 hours ago
From Jon Galloway (blog)
@laurentkempe Like I said, I'd pay money for it, and I'm very cheap. Very cool. about 15 hours ago from web in reply to laurentkempe
This tool let all authors write articles using a customized Word 2007, preview it offline in Internet Explorer as it will be seen on the portal and finally post the article to the portal directly from Word 2007. It is a replacement of THBAuthoring, my old tool found on CodePlex.
To achieve this goal I am using quite some technologies. First Word 2007, Ribbon, .NET Framework 3.5 SP1, VSTO 3.0, OpenXML, WordML, XML Schema, XSLT. Than for sure C#, Linq to XML, Linq to Object.
For the installation I use ClickOnce. That’s a great improvement! I had so much issues with THBAuthoring.
From an author point of view you are using a almost normal Word 2007 document with different predefined styles, bold, list… There is two exceptions:
- Source code
- Zip with sample code
The usage scenario for the inserting Source Code into the Word document is as following:
- Copy the code into the clipboard from Visual Studio 2008/2005
- Position the cursor into the Word 2007 document where you want to insert the Source Code
- Click on the button Source Code on the custom Ribbon
- That’s it, easy no?
This brings clear text of the source code into the document and colored source code into the HTML preview.
The usage scenario for attaching the Zip with the sample code is also easy:
- Click on the button Zip in the custom Ribbon
- In the opening File selector dialog browse to your zip file and select one
- That’s it, easy no?
Finally there is another usage scenario; inserting pictures:
- From Windows Explorer copy a picture file
- Position the cursor in the Word 2007 document
- Paste
- That’s it, easy no?
So, how does it work technically!
It works by doing a projection of the WordML to a well formed Tech Head Brothers XML document defined by an XML Schema. Then it uses a XSLT to produce HTML.
I hope to find the time to make a little video soon to demonstrate the way it is used!
Here is a picture of the tool

For three night now I focused on one scenario for the Tech Head Brothers authoring tool:
- As an author I want to be able to copy source code from Visual Studio and insert it into the authored Word document
- As an author I want to preview a document with source code inserted in Internet Explorer
This might not look really difficult at first, but I had some difficulties to fulfill the requirements of those two user story.
The first one was almost already implemented in step 7, using CustomXML capabilities of WordML.
The biggest issue I had was to figure out why when I was inserting CustomXML, the WordML format of the hyperlink was changing. It took me the most time to realize that inserting CustomXML was not the issue. The issue was proofing. Somehow inserting CustomXML was activating the auto proofing and then I got some error like on the following picture. The red underlined Brothers which is a link was the issue. In fact this simple thing change the WordML representation of the hyperlink.
As I had something working I had to find a way other than adding a second way to parse Hyperlinks. I came to the solution of disabling proofing then saving the document before making my projection to Tech Head Brothers XML. Then for sure re-enabling the proofing. Nice and easy!
The next issue was to be able at the time of parsing the WordML to identify that source code was at at the current position in the WordML. I turned and turned the problem, than asked some clever WordML guys (Julien, Pierre) and some generally good advisor (Mitsu, Cyril). Nothing! I finally came to a solution tonight:
- Getting the Id of the PlainTextContentControl from the WordML
- Searching for this Control in the Controls collection
- Finally using the plainTextContentControl.XMLMapping.CustomXMLPart.XML property I had access to my CustomXML
I couldn’t find any way to do that parsing the WordML and honestly tonight I don’t know how it is possible to go from the WordML to the CustomXML.
The result is here!
Copying source code from Visual Studio
Inserting it in Word 2007
Final result in Internet Explorer
There is still a little bug with the spacing that will solved tomorrow or later!
Now the next steps will be:
Projection of hyperlink Projection of picture - Projection of numbered list and
bullet list Fixing bugs found by Sébastien and Rédo Picture caption Giving the possibility to insert source code Projection of the source code - Adding the possibility to the author to post the article directly from Word to Tech Head Brothers web site using secured web services made out of WCF
- Adding all validation of the content