How would YOU handle dynamic document generation?



  • I just started a new job as a Business Systems Analyst at a law firm that deals with a truckload of dynamically generated and modified documents. Not just things like replacing names, but entire sections that only get displayed if certain data from the database is a certain value, or if it's only a specific document in a specific county, or with a specific judge presiding over the case. Very very dynamic.

    They manage this with an in-house application that uses templated RTF documents that gets parsed out programmatically, so you can use loops and conditionals in plain text and it gets interepreted and the document knows what database query it needs to run. The solution seems to work fairly well since there are thousands of template documents, some with minor things (simply replacing names) and others that have several pages worth of conditionals based on different criteria (basically a totally different document depending on the database values). The idea was to have dynamic data but allow for ease of formatting (tabs and spaces and the like).

    I can't help but think though there are ways to do this with Word and MS Office, even with VBA, to have conditional formatting and sections in a document, that must be a lot easier than putting [IF x] This is some content [END] homegrown template language for RTF files. The current way seems to work reasonably well (although it's a bit tricky to get used to) but I'm always keeping an eye out for some better or more sophisticated way of doing things in case I have the opportunity to recommend improvements.



  • A couple of years ago I had a job interview with a company that develops an open source document generator (http://www.libbit.eu/en/), it might be interesting to have a look at that. I eventually did not work there, because I got a job offer from another company that I accepted, but I am still in contact and they are doing very well with the software. It is deployed in several departments of the dutch government and I know from the discussions we had about design that it can work with templates that were mostly developed in a Word processor.



  • Oddly, I've just been assisting an english University with exactly the same thing - they have sections of text they wish to embed into documents for students, the final content being instructions varying upon the nature of the course attended.

    At present they have a content management system that does something for them but it's a bit restrictive, and digging deeper it seems it's a simple XML parser that's performing includes and chucking the resulting output in HTML.

    After a few days of them messing around with XSLT, they've decided upon building a set of basic templates with generic placeholders then dropping the relevent sections into the locations. They decided upon the XSLT route only because they could transform the same data into HTML for display on browsers (including mobile kit) but also into print-ready PDF.

    What emerged from the discussions wasn't the actual technology nor processes behind it, it was the data maintanence - how could they document and explain the relationships between the paragraph fragments, and how could a non-programmer create new templates without requiring programmer resource? They ran the risk of becoming someone that did donkey cut-n-pastework because others didn't know how to, and that really held them back from driving new developments forwards.


Log in to reply