9 comments

  1. I don’t think your solution will work in Office copies sold in the USA. Microsoft had to remove the custom XML feature because of a patent lawsuit. See this entry from Microsoft support:
    http://support.microsoft.com/kb/2445060

    Alex van Beek

  2. Ah the solution does still work. You can still use the custom schema and your custom xml. Word will save it all to your document and you can use the template just fine in your software. I ran into this problem on the job also and the thing that does not work in some copies, is when you reopen your template in Word. You will lose your custom markup. You can try to specify the markup in functional designs, that way you know how your template was marked up if you accidentally lose the mark up. For word 2007 and below this shouldnt be a problem though.

    If you do go with the 2007 and 2010 content controls approach, xslt is still a very flexible approach, especially because content controls allow xpath natively :). And in the end it is all XML..

    Chris van Beek

  3. I know, but contentcontrols require some extra work, it’s not like your solution works out of the box with contentcontrols. This is important for your american readers to know 🙂

    Alex

  4. Thanks for pointing it out. I did not know Microsoft had a support article about it! The solution is not intended to work with Content controls out of the box, but with custom xml tags. This will work fine in office 2007 and 2003 As for 2010 migrating the solution from custom xml to content controls is not much work at all, all you have to do is replace the custom xml tags with content controls, and adjust the template which extracts values to match on the contentcontrol element and use its xpath instead of matching the custom xml element and its query. All the rest can stay the same.

    In the future I will also post on generating with content controls by using their xml databinding functionality without any xslt at all so you can compare the two solutions :).

    Chris van Beek

  5. That post about contentcontrols would be interesting 🙂

    Alex van Beek

  6. I created an open source project (fleXdoc) that does exactly this, but supports richer constructs. Check it out here: http://flexdoc.codeplex.com

    Alex’s comments are correct. Choosing custom XML tags is not a very future proof direction. Content controls are and with some work, you can achieve similar functionality.

    By the way: Microsoft is not yet finished with the patents-case: http://www.zdnet.com/blog/microsoft/supreme-court-agrees-to-hear-microsoft-patent-infringement-appeal/8074?alertspromo=&tag=nl.rSINGLE

    Robert te Kaat

  7. I created an open source project (fleXdoc) that does exactly this, but supports richer constructs. Check it out here: http://flexdoc.codeplex.com

    Alex’s comments are correct. Choosing custom XML tags is not a very future proof direction. Content controls are and with some work, you can achieve similar functionality.

    By the way: Microsoft is not yet finished with the patents-case: http://www.zdnet.com/blog/microsoft/supreme-court-agrees-to-hear-microsoft-patent-infringement-appeal/8074?alertspromo=&tag=nl.rSINGLE

    Robert te Kaat

  8. Wow cool. I did not have the include or the image functionality, the rest is almost exactly the same. I think it would be quite a bit of work to do the same with content controls. Value of functionality would be easy, it is provide for us in Word with Xml databinding but the if, constructs the loops etc just screams xslt and xpath again..Plus how will you distinguish functionality between different content controls..

    But your codeplex project, cool stuff!:).

    Chris van Beek

  9. Same thing (pretty much) has been done using content controls by a colleague already. Although just a study assignment, he managed to implement similar functionality. The meta information that needs to come with the content controls (like what type (ValueOf, If, Image, etc), it’s properties (like path=”xslt…”), etc) needs to be stored inside a separate XML-part within the same document. To make editing the template possible, a Word-addin was created. It takes care of inserting the different type of controls and storing their properties inside the XML-part. Although not a production-ready solution, it could serve as a starting point for converting fleXdoc to content controls. However, as long as we still have Word 2007 copies laying around, why bother!

    Robert te Kaat

Comments are closed.